mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
.interval_kill_all method enhancements / bugfix
This commit is contained in:
parent
3c87a5965c
commit
d92704c374
1 changed files with 8 additions and 6 deletions
14
js/gui.js
14
js/gui.js
|
@ -89,7 +89,7 @@ GUI_control.prototype.interval_resume = function(name) {
|
|||
return false;
|
||||
};
|
||||
|
||||
// input = array of timers thats meant to be kept
|
||||
// input = array of timers thats meant to be kept, or nothing
|
||||
// return = returns timers killed in last call
|
||||
GUI_control.prototype.interval_kill_all = function(keep_array) {
|
||||
var timers_killed = 0;
|
||||
|
@ -98,11 +98,13 @@ GUI_control.prototype.interval_kill_all = function(keep_array) {
|
|||
var self = this;
|
||||
|
||||
var keep = false;
|
||||
keep_array.forEach(function(name) {
|
||||
if (self.interval_array[i].name == name) {
|
||||
keep = true;
|
||||
}
|
||||
});
|
||||
if (keep_array) { // only run through the array if it exists
|
||||
keep_array.forEach(function(name) {
|
||||
if (self.interval_array[i].name == name) {
|
||||
keep = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!keep) {
|
||||
clearInterval(this.interval_array[i].timer); // stop timer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue