mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
clear callbacks the smarter way
This commit is contained in:
parent
781d058228
commit
927589e22f
1 changed files with 7 additions and 6 deletions
|
@ -68,12 +68,13 @@ var MSP = {
|
|||
packet_error: 0,
|
||||
|
||||
callbacks_cleanup: function() {
|
||||
for (var i = 0; i < this.callbacks.length; i++) {
|
||||
for (var i = (this.callbacks.length - 1); i >= 0; i--) {
|
||||
// kill timer
|
||||
clearInterval(this.callbacks[i].timer);
|
||||
}
|
||||
|
||||
// drop references
|
||||
this.callbacks = [];
|
||||
// remove object/reference
|
||||
this.callbacks.splice(i, 1);
|
||||
}
|
||||
},
|
||||
|
||||
disconnect_cleanup: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue