Merge pull request #3334 from Conduitry/gh-3324

make raf a noop on server
pull/3342/head
Rich Harris 5 years ago committed by GitHub
commit 76d04dce9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,10 +1,12 @@
import { noop } from './utils';
export const is_client = typeof window !== 'undefined'; export const is_client = typeof window !== 'undefined';
export let now: () => number = is_client export let now: () => number = is_client
? () => window.performance.now() ? () => window.performance.now()
: () => Date.now(); : () => Date.now();
export let raf = cb => requestAnimationFrame(cb); export let raf = is_client ? cb => requestAnimationFrame(cb) : noop;
// used internally for testing // used internally for testing
export function set_now(fn) { export function set_now(fn) {

Loading…
Cancel
Save