@blocksuite/global
Advanced tools
Comparing version 0.0.0-canary-20241118001545 to 0.0.0-canary-20241119001457
# @blocksuite/global | ||
## 0.0.0-canary-20241118001545 | ||
## 0.0.0-canary-20241119001457 | ||
@@ -5,0 +5,0 @@ ### Patch Changes |
@@ -29,2 +29,3 @@ export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>; | ||
}) => T; | ||
export declare function nextTick(): Promise<any>; | ||
//# sourceMappingURL=function.d.ts.map |
@@ -74,2 +74,15 @@ export async function sleep(ms, signal) { | ||
}; | ||
export async function nextTick() { | ||
// @ts-ignore | ||
if ('scheduler' in window && 'yield' in window.scheduler) { | ||
// @ts-ignore | ||
return window.scheduler.yield(); | ||
} | ||
else if (typeof requestIdleCallback !== 'undefined') { | ||
return new Promise(resolve => requestIdleCallback(resolve)); | ||
} | ||
else { | ||
return new Promise(resolve => setTimeout(resolve, 0)); | ||
} | ||
} | ||
//# sourceMappingURL=function.js.map |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.0.0-canary-20241118001545", | ||
"version": "0.0.0-canary-20241119001457", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -115,1 +115,13 @@ export async function sleep(ms: number, signal?: AbortSignal): Promise<void> { | ||
}; | ||
export async function nextTick() { | ||
// @ts-ignore | ||
if ('scheduler' in window && 'yield' in window.scheduler) { | ||
// @ts-ignore | ||
return window.scheduler.yield(); | ||
} else if (typeof requestIdleCallback !== 'undefined') { | ||
return new Promise(resolve => requestIdleCallback(resolve)); | ||
} else { | ||
return new Promise(resolve => setTimeout(resolve, 0)); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
720362
11050