fix: don't access requestAnimationFrame eagerly (#14026)

pull/14033/head
Ben McCann 6 days ago committed by GitHub
parent b3437e6020
commit 08bc37a374
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,13 +3,11 @@ import { noop } from '../shared/utils.js';
import { BROWSER } from 'esm-env';
const request_animation_frame = BROWSER ? requestAnimationFrame : noop;
const now = BROWSER ? () => performance.now() : () => Date.now();
/** @type {Raf} */
export const raf = {
tick: /** @param {any} _ */ (_) => request_animation_frame(_),
tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
now: () => now(),
tasks: new Set()
};

Loading…
Cancel
Save