| 1 |
import { AsyncAction } from './AsyncAction'; |
| 2 |
export class QueueAction extends AsyncAction { |
| 3 |
constructor(scheduler, work) { |
| 4 |
super(scheduler, work); |
| 5 |
this.scheduler = scheduler; |
| 6 |
this.work = work; |
| 7 |
} |
| 8 |
schedule(state, delay = 0) { |
| 9 |
if (delay > 0) { |
| 10 |
return super.schedule(state, delay); |
| 11 |
} |
| 12 |
this.delay = delay; |
| 13 |
this.state = state; |
| 14 |
this.scheduler.flush(this); |
| 15 |
return this; |
| 16 |
} |
| 17 |
execute(state, delay) { |
| 18 |
return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay); |
| 19 |
} |
| 20 |
requestAsyncId(scheduler, id, delay = 0) { |
| 21 |
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) { |
| 22 |
return super.requestAsyncId(scheduler, id, delay); |
| 23 |
} |
| 24 |
scheduler.flush(this); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
} |
| 28 |
//# sourceMappingURL=QueueAction.js.map |