0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-24 00:07:30 +01:00

chore: add changeset and comment (#14040)

for #14026
This commit is contained in:
Ben McCann 2024-10-30 08:35:26 -07:00 committed by GitHub
parent 8a2c97a7b8
commit 217e40998a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: don't access `requestAnimationFrame` until needed to reduce need for mocks during testing

View File

@ -7,6 +7,9 @@ const now = BROWSER ? () => performance.now() : () => Date.now();
/** @type {Raf} */
export const raf = {
// don't access requestAnimationFrame eagerly outside method
// this allows basic testing of user code without JSDOM
// bunder will eval and remove ternary when the user's app is built
tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
now: () => now(),
tasks: new Set()