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:
912 bytes
|
Rev | Line | |
---|
[6a3a178] | 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) ?
|
---|
| 19 | super.execute(state, delay) :
|
---|
| 20 | this._execute(state, delay);
|
---|
| 21 | }
|
---|
| 22 | requestAsyncId(scheduler, id, delay = 0) {
|
---|
| 23 | if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
|
---|
| 24 | return super.requestAsyncId(scheduler, id, delay);
|
---|
| 25 | }
|
---|
| 26 | return scheduler.flush(this);
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 | //# sourceMappingURL=QueueAction.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.