Skip to content

Commit 3430305

Browse files
committed
cleanup
1 parent 30bf2f6 commit 3430305

File tree

1 file changed

+6
-1
lines changed
  • packages/svelte/src/internal/client/dom

1 file changed

+6
-1
lines changed

packages/svelte/src/internal/client/dom/task.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export const request_idle_callback =
1212
export const schedule_yield =
1313
// @ts-ignore
1414
typeof scheduler === 'undefined'
15-
? (/** @type {() => void} */ cb) => setTimeout(cb, 1)
15+
? (/** @type {() => void} */ cb) => {
16+
// For Safari, we fallback to using MessageChannel
17+
const channel = new MessageChannel();
18+
channel.port1.onmessage = cb;
19+
channel.port2.postMessage(undefined);
20+
}
1621
: async (/** @type {() => void} */ fn) => {
1722
// @ts-ignore
1823
await scheduler.yield();

0 commit comments

Comments
 (0)