Skip to content

Commit 217e409

Browse files
authored
chore: add changeset and comment (#14040)
for #14026
1 parent 8a2c97a commit 217e409

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/small-bobcats-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const now = BROWSER ? () => performance.now() : () => Date.now();
77

88
/** @type {Raf} */
99
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
1013
tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
1114
now: () => now(),
1215
tasks: new Set()

0 commit comments

Comments
 (0)