18cc145f7d82dc2c9323f04eda1a91488d5ca46ad5d49d51c86b17b1a5fd9243c8de693fafcc70a8daae8333d4b2510df81e5229d68e7484b2a0e5f245b67a 729 B

123456789101112131415161718192021
  1. import env from '../core/env';
  2. type RequestAnimationFrameType = typeof window.requestAnimationFrame
  3. let requestAnimationFrame: RequestAnimationFrameType;
  4. requestAnimationFrame = (
  5. env.hasGlobalWindow
  6. && (
  7. (window.requestAnimationFrame && window.requestAnimationFrame.bind(window))
  8. // https://github.com/ecomfe/zrender/issues/189#issuecomment-224919809
  9. || ((window as any).msRequestAnimationFrame && (window as any).msRequestAnimationFrame.bind(window))
  10. || (window as any).mozRequestAnimationFrame
  11. // @ts-ignore
  12. || window.webkitRequestAnimationFrame
  13. )
  14. ) || function (func: Parameters<RequestAnimationFrameType>[0]): number {
  15. return setTimeout(func, 16) as any;
  16. };
  17. export default requestAnimationFrame;