AnimationFrame.js 1.7KB

12345678910111213141516171819202122232425262728293031323334
  1. /** PURE_IMPORTS_START ._root PURE_IMPORTS_END */
  2. import { root } from './root';
  3. export var RequestAnimationFrameDefinition = /*@__PURE__*/ (/*@__PURE__*/ function () {
  4. function RequestAnimationFrameDefinition(root) {
  5. if (root.requestAnimationFrame) {
  6. this.cancelAnimationFrame = root.cancelAnimationFrame.bind(root);
  7. this.requestAnimationFrame = root.requestAnimationFrame.bind(root);
  8. }
  9. else if (root.mozRequestAnimationFrame) {
  10. this.cancelAnimationFrame = root.mozCancelAnimationFrame.bind(root);
  11. this.requestAnimationFrame = root.mozRequestAnimationFrame.bind(root);
  12. }
  13. else if (root.webkitRequestAnimationFrame) {
  14. this.cancelAnimationFrame = root.webkitCancelAnimationFrame.bind(root);
  15. this.requestAnimationFrame = root.webkitRequestAnimationFrame.bind(root);
  16. }
  17. else if (root.msRequestAnimationFrame) {
  18. this.cancelAnimationFrame = root.msCancelAnimationFrame.bind(root);
  19. this.requestAnimationFrame = root.msRequestAnimationFrame.bind(root);
  20. }
  21. else if (root.oRequestAnimationFrame) {
  22. this.cancelAnimationFrame = root.oCancelAnimationFrame.bind(root);
  23. this.requestAnimationFrame = root.oRequestAnimationFrame.bind(root);
  24. }
  25. else {
  26. this.cancelAnimationFrame = root.clearTimeout.bind(root);
  27. this.requestAnimationFrame = function (cb) { return root.setTimeout(cb, 1000 / 60); };
  28. }
  29. }
  30. return RequestAnimationFrameDefinition;
  31. }());
  32. export var AnimationFrame = /*@__PURE__*/ new RequestAnimationFrameDefinition(root);
  33. //# sourceMappingURL=AnimationFrame.js.map