Skip to content

Commit 08bc37a

Browse files
authored
fix: don't access requestAnimationFrame eagerly (#14026)
1 parent b3437e6 commit 08bc37a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/svelte/src/internal/client/timing.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import { noop } from '../shared/utils.js';
33

44
import { BROWSER } from 'esm-env';
55

6-
const request_animation_frame = BROWSER ? requestAnimationFrame : noop;
7-
86
const now = BROWSER ? () => performance.now() : () => Date.now();
97

108
/** @type {Raf} */
119
export const raf = {
12-
tick: /** @param {any} _ */ (_) => request_animation_frame(_),
10+
tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
1311
now: () => now(),
1412
tasks: new Set()
1513
};

0 commit comments

Comments
 (0)