AnimationFrameScheduler.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { __extends } from "tslib";
  2. import { AsyncScheduler } from './AsyncScheduler';
  3. var AnimationFrameScheduler = (function (_super) {
  4. __extends(AnimationFrameScheduler, _super);
  5. function AnimationFrameScheduler() {
  6. return _super !== null && _super.apply(this, arguments) || this;
  7. }
  8. AnimationFrameScheduler.prototype.flush = function (action) {
  9. this._active = true;
  10. var flushId;
  11. if (action) {
  12. flushId = action.id;
  13. }
  14. else {
  15. flushId = this._scheduled;
  16. this._scheduled = undefined;
  17. }
  18. var actions = this.actions;
  19. var error;
  20. action = action || actions.shift();
  21. do {
  22. if ((error = action.execute(action.state, action.delay))) {
  23. break;
  24. }
  25. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  26. this._active = false;
  27. if (error) {
  28. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  29. action.unsubscribe();
  30. }
  31. throw error;
  32. }
  33. };
  34. return AnimationFrameScheduler;
  35. }(AsyncScheduler));
  36. export { AnimationFrameScheduler };
  37. //# sourceMappingURL=AnimationFrameScheduler.js.map