Debian Codegraph @

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

raw
1 import { __extends } from "tslib";
2 import { AsyncAction } from './AsyncAction';
3 import { animationFrameProvider } from './animationFrameProvider';
4 var AnimationFrameAction = (function (_super) {
5 __extends(AnimationFrameAction, _super);
6 function AnimationFrameAction(scheduler, work) {
7 var _this = _super.call(this, scheduler, work) || this;
8 _this.scheduler = scheduler;
9 _this.work = work;
10 return _this;
11 }
12 AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {
13 if (delay === void 0) { delay = 0; }
14 if (delay !== null && delay > 0) {
15 return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
16 }
17 scheduler.actions.push(this);
18 return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function () { return scheduler.flush(undefined); }));
19 };
20 AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
21 var _a;
22 if (delay === void 0) { delay = 0; }
23 if (delay != null ? delay > 0 : this.delay > 0) {
24 return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
25 }
26 var actions = scheduler.actions;
27 if (id != null && id === scheduler._scheduled && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
28 animationFrameProvider.cancelAnimationFrame(id);
29 scheduler._scheduled = undefined;
30 }
31 return undefined;
32 };
33 return AnimationFrameAction;
34 }(AsyncAction));
35 export { AnimationFrameAction };
36 //# sourceMappingURL=AnimationFrameAction.js.map