animationFrame.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /** PURE_IMPORTS_START ._AnimationFrameAction,._AnimationFrameScheduler PURE_IMPORTS_END */
  2. import { AnimationFrameAction } from './AnimationFrameAction';
  3. import { AnimationFrameScheduler } from './AnimationFrameScheduler';
  4. /**
  5. *
  6. * Animation Frame Scheduler
  7. *
  8. * <span class="informal">Perform task when `window.requestAnimationFrame` would fire</span>
  9. *
  10. * When `animationFrame` scheduler is used with delay, it will fall back to {@link async} scheduler
  11. * behaviour.
  12. *
  13. * Without delay, `animationFrame` scheduler can be used to create smooth browser animations.
  14. * It makes sure scheduled task will happen just before next browser content repaint,
  15. * thus performing animations as efficiently as possible.
  16. *
  17. * @example <caption>Schedule div height animation</caption>
  18. * const div = document.querySelector('.some-div');
  19. *
  20. * Rx.Scheduler.schedule(function(height) {
  21. * div.style.height = height + "px";
  22. *
  23. * this.schedule(height + 1); // `this` references currently executing Action,
  24. * // which we reschedule with new state
  25. * }, 0, 0);
  26. *
  27. * // You will see .some-div element growing in height
  28. *
  29. *
  30. * @static true
  31. * @name animationFrame
  32. * @owner Scheduler
  33. */
  34. export var animationFrame = /*@__PURE__*/ new AnimationFrameScheduler(AnimationFrameAction);
  35. //# sourceMappingURL=animationFrame.js.map