|
|
@ -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) {
|
|
|
|