source: trip-planner-front/node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Scheduler } from '../Scheduler';
4var AsyncScheduler = /*@__PURE__*/ (function (_super) {
5 tslib_1.__extends(AsyncScheduler, _super);
6 function AsyncScheduler(SchedulerAction, now) {
7 if (now === void 0) {
8 now = Scheduler.now;
9 }
10 var _this = _super.call(this, SchedulerAction, function () {
11 if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {
12 return AsyncScheduler.delegate.now();
13 }
14 else {
15 return now();
16 }
17 }) || this;
18 _this.actions = [];
19 _this.active = false;
20 _this.scheduled = undefined;
21 return _this;
22 }
23 AsyncScheduler.prototype.schedule = function (work, delay, state) {
24 if (delay === void 0) {
25 delay = 0;
26 }
27 if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
28 return AsyncScheduler.delegate.schedule(work, delay, state);
29 }
30 else {
31 return _super.prototype.schedule.call(this, work, delay, state);
32 }
33 };
34 AsyncScheduler.prototype.flush = function (action) {
35 var actions = this.actions;
36 if (this.active) {
37 actions.push(action);
38 return;
39 }
40 var error;
41 this.active = true;
42 do {
43 if (error = action.execute(action.state, action.delay)) {
44 break;
45 }
46 } while (action = actions.shift());
47 this.active = false;
48 if (error) {
49 while (action = actions.shift()) {
50 action.unsubscribe();
51 }
52 throw error;
53 }
54 };
55 return AsyncScheduler;
56}(Scheduler));
57export { AsyncScheduler };
58//# sourceMappingURL=AsyncScheduler.js.map
Note: See TracBrowser for help on using the repository browser.