diff --git a/src/runtime/internal/environment.ts b/src/runtime/internal/environment.ts index a1d50b5521..7123399180 100644 --- a/src/runtime/internal/environment.ts +++ b/src/runtime/internal/environment.ts @@ -1,10 +1,12 @@ +import { noop } from './utils'; + export const is_client = typeof window !== 'undefined'; export let now: () => number = is_client ? () => window.performance.now() : () => Date.now(); -export let raf = cb => requestAnimationFrame(cb); +export let raf = is_client ? cb => requestAnimationFrame(cb) : noop; // used internally for testing export function set_now(fn) {