Files
rustfs-console/lib/schedule-microtask.ts
T

14 lines
285 B
TypeScript

export function scheduleMicrotask(callback: () => void) {
if (typeof queueMicrotask === "function") {
queueMicrotask(callback)
return
}
if (typeof Promise === "function") {
void Promise.resolve().then(callback)
return
}
globalThis.setTimeout(callback, 0)
}