We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a2c97a commit 217e409Copy full SHA for 217e409
.changeset/small-bobcats-add.md
@@ -0,0 +1,5 @@
1
+---
2
+'svelte': patch
3
4
+
5
+fix: don't access `requestAnimationFrame` until needed to reduce need for mocks during testing
packages/svelte/src/internal/client/timing.js
@@ -7,6 +7,9 @@ const now = BROWSER ? () => performance.now() : () => Date.now();
7
8
/** @type {Raf} */
9
export const raf = {
10
+ // don't access requestAnimationFrame eagerly outside method
11
+ // this allows basic testing of user code without JSDOM
12
+ // bunder will eval and remove ternary when the user's app is built
13
tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
14
now: () => now(),
15
tasks: new Set()
0 commit comments