Skip to content

Commit

Permalink
ensure correct requestAnimationFrame context (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
johman10 authored and Conduitry committed Jun 16, 2019
1 parent be783c5 commit acdcaa4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function once(fn) {
if (ran) return;
ran = true;
fn.call(this, ...args);
}
};
}

const is_client = typeof window !== 'undefined';
Expand All @@ -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) {
Expand Down

0 comments on commit acdcaa4

Please sign in to comment.