From acdcaa41bfde4fc1b74dca33e48a6e4d3895667d Mon Sep 17 00:00:00 2001 From: Johan Date: Sun, 16 Jun 2019 11:14:39 +0200 Subject: [PATCH] ensure correct requestAnimationFrame context (#2933) --- src/runtime/internal/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/internal/utils.ts b/src/runtime/internal/utils.ts index 152c0e79b0..097a7df74b 100644 --- a/src/runtime/internal/utils.ts +++ b/src/runtime/internal/utils.ts @@ -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) {