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:
commit
d3addd2d25
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue