1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-20 23:05:15 +03:00

Merge pull request #2261 from McGiverGim/use_node_timeout

Replace timeout/interval functions by Node ones
This commit is contained in:
Michael Keller 2020-10-30 00:48:55 +13:00 committed by GitHub
commit d3addd2d25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,11 +4,26 @@ window.googleAnalytics = analytics;
window.analytics = null; window.analytics = null;
$(document).ready(function () { $(document).ready(function () {
useGlobalNodeFunctions();
if (typeof cordovaApp === 'undefined') { if (typeof cordovaApp === 'undefined') {
appReady(); appReady();
} }
}); });
function useGlobalNodeFunctions() {
// The global functions of Node continue working on background. This is good to continue flashing,
// for example, when the window is minimized
if (GUI.isNWJS()) {
console.log("Replacing timeout/interval functions with Node versions");
window.setTimeout = global.setTimeout;
window.clearTimeout = global.clearTimeout;
window.setInterval = global.setInterval;
window.clearInterval = global.clearInterval;
}
}
function appReady() { function appReady() {
$.getJSON('version.json', function(data) { $.getJSON('version.json', function(data) {
CONFIGURATOR.version = data.version; CONFIGURATOR.version = data.version;