From ba1ffc20a1d5f75f16b15615d4e7a9eb22ccd756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 16 Nov 2016 22:39:15 +0100 Subject: [PATCH] Fix window error on the server-side --- src/client/batchUpdate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/batchUpdate.js b/src/client/batchUpdate.js index c1e2c9dd..decf519f 100644 --- a/src/client/batchUpdate.js +++ b/src/client/batchUpdate.js @@ -1,6 +1,6 @@ // fallback to timers if rAF not present -const stopUpdate = window.cancelAnimationFrame || window.clearTimeout -const startUpdate = window.requestAnimationFrame || ((cb) => window.setTimeout(cb, 0)) +const stopUpdate = (typeof window !== 'undefined' ? window.cancelAnimationFrame : null) || clearTimeout +const startUpdate = (typeof window !== 'undefined' ? window.requestAnimationFrame : null) || ((cb) => window.setTimeout(cb, 0)) /** * Performs a batched update. Uses requestAnimationFrame to prevent