Skip to content

Commit

Permalink
Merge pull request #3334 from Conduitry/gh-3324
Browse files Browse the repository at this point in the history
make raf a noop on server
  • Loading branch information
Rich-Harris authored Aug 3, 2019
2 parents 9e15546 + b44a876 commit 76d04dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/internal/environment.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 76d04dc

Please sign in to comment.