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.

AsapAction.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /** PURE_IMPORTS_START tslib,_util_Immediate,_AsyncAction PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Immediate } from '../util/Immediate';
  4. import { AsyncAction } from './AsyncAction';
  5. var AsapAction = /*@__PURE__*/ (function (_super) {
  6. tslib_1.__extends(AsapAction, _super);
  7. function AsapAction(scheduler, work) {
  8. var _this = _super.call(this, scheduler, work) || this;
  9. _this.scheduler = scheduler;
  10. _this.work = work;
  11. return _this;
  12. }
  13. AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  14. if (delay === void 0) {
  15. delay = 0;
  16. }
  17. if (delay !== null && delay > 0) {
  18. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  19. }
  20. scheduler.actions.push(this);
  21. return scheduler.scheduled || (scheduler.scheduled = Immediate.setImmediate(scheduler.flush.bind(scheduler, null)));
  22. };
  23. AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  24. if (delay === void 0) {
  25. delay = 0;
  26. }
  27. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  28. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
  29. }
  30. if (scheduler.actions.length === 0) {
  31. Immediate.clearImmediate(id);
  32. scheduler.scheduled = undefined;
  33. }
  34. return undefined;
  35. };
  36. return AsapAction;
  37. }(AsyncAction));
  38. export { AsapAction };
  39. //# sourceMappingURL=AsapAction.js.map