Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1023 bytes
|
Line | |
---|
1 | import { Immediate } from '../util/Immediate';
|
---|
2 | import { AsyncAction } from './AsyncAction';
|
---|
3 | export class AsapAction extends AsyncAction {
|
---|
4 | constructor(scheduler, work) {
|
---|
5 | super(scheduler, work);
|
---|
6 | this.scheduler = scheduler;
|
---|
7 | this.work = work;
|
---|
8 | }
|
---|
9 | requestAsyncId(scheduler, id, delay = 0) {
|
---|
10 | if (delay !== null && delay > 0) {
|
---|
11 | return super.requestAsyncId(scheduler, id, delay);
|
---|
12 | }
|
---|
13 | scheduler.actions.push(this);
|
---|
14 | return scheduler.scheduled || (scheduler.scheduled = Immediate.setImmediate(scheduler.flush.bind(scheduler, null)));
|
---|
15 | }
|
---|
16 | recycleAsyncId(scheduler, id, delay = 0) {
|
---|
17 | if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
|
---|
18 | return super.recycleAsyncId(scheduler, id, delay);
|
---|
19 | }
|
---|
20 | if (scheduler.actions.length === 0) {
|
---|
21 | Immediate.clearImmediate(id);
|
---|
22 | scheduler.scheduled = undefined;
|
---|
23 | }
|
---|
24 | return undefined;
|
---|
25 | }
|
---|
26 | }
|
---|
27 | //# sourceMappingURL=AsapAction.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.