mirror of
https://github.com/rustfs/console.git
synced 2026-08-28 19:47:21 +08:00
14 lines
285 B
TypeScript
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)
|
|
}
|