|
|
@ -12,7 +12,12 @@ export const request_idle_callback =
|
|
|
|
export const schedule_yield =
|
|
|
|
export const schedule_yield =
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
typeof scheduler === 'undefined'
|
|
|
|
typeof scheduler === 'undefined'
|
|
|
|
? (/** @type {() => void} */ cb) => setTimeout(cb, 1)
|
|
|
|
? (/** @type {() => void} */ cb) => {
|
|
|
|
|
|
|
|
// For Safari, we fallback to using MessageChannel
|
|
|
|
|
|
|
|
const channel = new MessageChannel();
|
|
|
|
|
|
|
|
channel.port1.onmessage = cb;
|
|
|
|
|
|
|
|
channel.port2.postMessage(undefined);
|
|
|
|
|
|
|
|
}
|
|
|
|
: async (/** @type {() => void} */ fn) => {
|
|
|
|
: async (/** @type {() => void} */ fn) => {
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
await scheduler.yield();
|
|
|
|
await scheduler.yield();
|
|
|
|