From beaac87760607fcb8807c39355fd5a9acdcac9b0 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 11 Dec 2017 10:23:44 +0800 Subject: [PATCH] [hotfix] raf error in SSR (#405) --- packages/utils/raf.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/utils/raf.js b/packages/utils/raf.js index b04403a1f..b40d315bd 100644 --- a/packages/utils/raf.js +++ b/packages/utils/raf.js @@ -16,24 +16,18 @@ function fallback(fn) { } /* istanbul ignore next */ -const global = isServer ? global : window; +const root = isServer ? global : window; /* istanbul ignore next */ -const iRaf = - global.requestAnimationFrame || - global.webkitRequestAnimationFrame || - fallback; +const iRaf = root.requestAnimationFrame || root.webkitRequestAnimationFrame || fallback; /* istanbul ignore next */ -const iCancel = - global.cancelAnimationFrame || - global.webkitCancelAnimationFrame || - global.clearTimeout; +const iCancel = root.cancelAnimationFrame || root.webkitCancelAnimationFrame || root.clearTimeout; export function raf(fn) { - return iRaf.call(global, fn); + return iRaf.call(root, fn); } export function cancel(id) { - iCancel.call(global, id); + iCancel.call(root, id); }