1
0
Fork 0
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:
cTn 2014-02-28 14:07:11 +01:00
parent 781d058228
commit 927589e22f

View file

@ -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() {