mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-24 00:07:30 +01:00
parent
8a2c97a7b8
commit
217e40998a
5
.changeset/small-bobcats-add.md
Normal file
5
.changeset/small-bobcats-add.md
Normal file
@ -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} */
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user