Debian Codegraph @

node/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js

raw
1 import { AsyncAction } from './AsyncAction';
2 import { animationFrameProvider } from './animationFrameProvider';
3 export class AnimationFrameAction 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 = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));
15 }
16 recycleAsyncId(scheduler, id, delay = 0) {
17 var _a;
18 if (delay != null ? delay > 0 : this.delay > 0) {
19 return super.recycleAsyncId(scheduler, id, delay);
20 }
21 const { actions } = scheduler;
22 if (id != null && id === scheduler._scheduled && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
23 animationFrameProvider.cancelAnimationFrame(id);
24 scheduler._scheduled = undefined;
25 }
26 return undefined;
27 }
28 }
29 //# sourceMappingURL=AnimationFrameAction.js.map