Front end of the Slack clone application.

AnimationFrame.js 1.5KB

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