[improvement] optimize utils (#3104)

This commit is contained in:
neverland
2019-04-08 17:21:05 +08:00
committed by GitHub
parent 1a7daecdbc
commit d3054fd4b0
3 changed files with 20 additions and 11 deletions

View File

@@ -19,10 +19,10 @@ function fallback(fn: FrameRequestCallback): number {
const root = <Window>(isServer ? global : window);
/* istanbul ignore next */
const iRaf = root.requestAnimationFrame || root.webkitRequestAnimationFrame || fallback;
const iRaf = root.requestAnimationFrame || fallback;
/* istanbul ignore next */
const iCancel = root.cancelAnimationFrame || root.webkitCancelAnimationFrame || root.clearTimeout;
const iCancel = root.cancelAnimationFrame || root.clearTimeout;
export function raf(fn: FrameRequestCallback): number {
return iRaf.call(root, fn);