chore: add changeset and comment

pull/14040/head
Ben McCann 2 years ago
parent 1434f48f7c
commit 4249814443

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

@ -7,6 +7,9 @@ const now = BROWSER ? () => performance.now() : () => Date.now();
/** @type {Raf} */ /** @type {Raf} */
export const 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)(_), tick: /** @param {any} _ */ (_) => (BROWSER ? requestAnimationFrame : noop)(_),
now: () => now(), now: () => now(),
tasks: new Set() tasks: new Set()

Loading…
Cancel
Save