0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 01:11:24 +01:00

ensure correct requestAnimationFrame context (#2933)

This commit is contained in:
Johan 2019-06-16 11:14:39 +02:00 committed by Conduitry
parent be783c5c67
commit acdcaa41bf

View File

@ -87,7 +87,7 @@ export function once(fn) {
if (ran) return;
ran = true;
fn.call(this, ...args);
}
};
}
const is_client = typeof window !== 'undefined';
@ -96,7 +96,7 @@ export let now: () => number = is_client
? () => window.performance.now()
: () => Date.now();
export let raf = is_client ? requestAnimationFrame : noop;
export let raf = cb => requestAnimationFrame(cb);
// used internally for testing
export function set_now(fn) {