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