1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-21 15:25:22 +03:00

Replace timeout/interval functions by Node ones

This commit is contained in:
Miguel Angel Mulero Martinez 2020-10-26 09:55:40 +01:00
parent ebbce62bac
commit 3c89029015

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;