a zip code crypto-currency system good for red ONLY

QueueAction.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /** PURE_IMPORTS_START ._AsyncAction PURE_IMPORTS_END */
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b)
  4. if (b.hasOwnProperty(p))
  5. d[p] = b[p];
  6. function __() { this.constructor = d; }
  7. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8. };
  9. import { AsyncAction } from './AsyncAction';
  10. /**
  11. * We need this JSDoc comment for affecting ESDoc.
  12. * @ignore
  13. * @extends {Ignored}
  14. */
  15. export var QueueAction = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  16. __extends(QueueAction, _super);
  17. function QueueAction(scheduler, work) {
  18. _super.call(this, scheduler, work);
  19. this.scheduler = scheduler;
  20. this.work = work;
  21. }
  22. QueueAction.prototype.schedule = function (state, delay) {
  23. if (delay === void 0) {
  24. delay = 0;
  25. }
  26. if (delay > 0) {
  27. return _super.prototype.schedule.call(this, state, delay);
  28. }
  29. this.delay = delay;
  30. this.state = state;
  31. this.scheduler.flush(this);
  32. return this;
  33. };
  34. QueueAction.prototype.execute = function (state, delay) {
  35. return (delay > 0 || this.closed) ?
  36. _super.prototype.execute.call(this, state, delay) :
  37. this._execute(state, delay);
  38. };
  39. QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  40. if (delay === void 0) {
  41. delay = 0;
  42. }
  43. // If delay exists and is greater than 0, or if the delay is null (the
  44. // action wasn't rescheduled) but was originally scheduled as an async
  45. // action, then recycle as an async action.
  46. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  47. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  48. }
  49. // Otherwise flush the scheduler starting with this action.
  50. return scheduler.flush(this);
  51. };
  52. return QueueAction;
  53. }(AsyncAction));
  54. //# sourceMappingURL=QueueAction.js.map