Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QueueAction.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { AsyncAction } from './AsyncAction';
  4. var QueueAction = /*@__PURE__*/ (function (_super) {
  5. tslib_1.__extends(QueueAction, _super);
  6. function QueueAction(scheduler, work) {
  7. var _this = _super.call(this, scheduler, work) || this;
  8. _this.scheduler = scheduler;
  9. _this.work = work;
  10. return _this;
  11. }
  12. QueueAction.prototype.schedule = function (state, delay) {
  13. if (delay === void 0) {
  14. delay = 0;
  15. }
  16. if (delay > 0) {
  17. return _super.prototype.schedule.call(this, state, delay);
  18. }
  19. this.delay = delay;
  20. this.state = state;
  21. this.scheduler.flush(this);
  22. return this;
  23. };
  24. QueueAction.prototype.execute = function (state, delay) {
  25. return (delay > 0 || this.closed) ?
  26. _super.prototype.execute.call(this, state, delay) :
  27. this._execute(state, delay);
  28. };
  29. QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  30. if (delay === void 0) {
  31. delay = 0;
  32. }
  33. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  34. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  35. }
  36. return scheduler.flush(this);
  37. };
  38. return QueueAction;
  39. }(AsyncAction));
  40. export { QueueAction };
  41. //# sourceMappingURL=QueueAction.js.map