From 629bdbf3faaacad5cfd8196e2cf0fc8c3dd20d0f Mon Sep 17 00:00:00 2001 From: "S. Elliott Johnson" Date: Mon, 8 May 2023 21:50:35 -0600 Subject: [PATCH] Convert src/runtime/internal/environment.ts to JavaScript --- src/runtime/internal/environment.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/runtime/internal/environment.ts b/src/runtime/internal/environment.ts index 4c93b27835..0246306a9a 100644 --- a/src/runtime/internal/environment.ts +++ b/src/runtime/internal/environment.ts @@ -1,16 +1,18 @@ import { noop } from './utils'; - export const is_client = typeof window !== 'undefined'; - -export let now: () => number = is_client ? () => window.performance.now() : () => Date.now(); - +/** @type {() => number} */ +export let now = is_client ? () => window.performance.now() : () => Date.now(); export let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop; - // used internally for testing +/** @returns {void} */ export function set_now(fn) { - now = fn; + now = fn; } - +/** @returns {void} */ export function set_raf(fn) { - raf = fn; + raf = fn; } + + + +