QueueExecutor.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0}),
  5. (i.QueueExecutor = void 0),
  6. (i.QueueExecutor = class {
  7. constructor() {
  8. (this._isRuning = !1), (this._functions = []);
  9. }
  10. queueCnt() {
  11. return this._functions.length;
  12. }
  13. getState() {
  14. return this._isRuning;
  15. }
  16. setCallBack(t, e) {
  17. (this._callBack = t), (this._callBackTarget = e);
  18. }
  19. regist(t, e, i) {
  20. this._functions.push([t, e, i]), this.next();
  21. }
  22. start() {
  23. this.next();
  24. }
  25. finishFunc() {
  26. (this._isRuning = !1), this.next();
  27. }
  28. reset() {
  29. (this._isRuning = !1), (this._functions = []);
  30. }
  31. next() {
  32. var t;
  33. this._isRuning ||
  34. (0 == this._functions.length
  35. ? (this._callBack && this._callBack.call(this._callBackTarget),
  36. (this._callBack = null),
  37. (this._callBackTarget = null))
  38. : ((this._isRuning = !0), (t = this._functions.shift())[0].apply(t[1], t[2])));
  39. }
  40. });