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 a5a566d commit 622195cCopy full SHA for 622195c
.changeset/pink-bikes-agree.md
@@ -0,0 +1,5 @@
1
+---
2
+"svelte": patch
3
4
+
5
+fix: ensure performance.now() and requestAnimationFrame() are polyfilled in ssr
packages/svelte/src/internal/client/timing.js
@@ -1,5 +1,13 @@
+import { noop } from '../common.js';
+const is_client = typeof window !== 'undefined';
+const request_animation_frame = is_client ? requestAnimationFrame : noop;
6
7
+const now = is_client ? () => performance.now() : () => Date.now();
8
9
/** @type {import('./types.js').Raf} */
10
export const raf = {
- tick: /** @param {any} _ */ (_) => requestAnimationFrame(_),
- now: () => performance.now()
11
+ tick: /** @param {any} _ */ (_) => request_animation_frame(_),
12
+ now: () => now()
13
};
0 commit comments