1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 03:49:53 +03:00
inav-configurator/js/msp/MSPchainer.js
Pawel Spychalski (DzikuVx) 912864bc19 load custom smix rules
2018-01-20 11:43:31 +01:00

35 lines
No EOL
729 B
JavaScript

/*global $*/
'use strict';
var MSPChainerClass = function () {
var self = {};
self.chain = [];
self.exitPoint = null;
self.chainIndex = 0;
self.setChain = function (chain) {
self.chain = chain;
};
self.setExitPoint = function (exitPoint) {
self.exitPoint = exitPoint;
};
self.returnCallback = function () {
self.chainIndex++;
if (self.chain[self.chainIndex]) {
self.chain[self.chainIndex](self.returnCallback);
} else if (self.exitPoint) {
self.exitPoint();
}
};
self.execute = function () {
self.chainIndex = 0;
self.chain[self.chainIndex](self.returnCallback);
};
return self;
};