deno.land / x / replicache@v10.0.0-beta.0 / request-idle.ts

request-idle.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// TODO(arv): Remove workaround once docs/ builds cleanly without this.declare function requestIdleCallback( callback: () => void, options?: {timeout?: number},): number;
/** * A Promise wrapper for requestIdleCallback with fallback to setTimeout for * browsers without support (aka Safari) */export function requestIdle(timeout: number): Promise<void> { return new Promise(resolve => { if (typeof requestIdleCallback === 'function') { requestIdleCallback(() => resolve(), {timeout}); } else { setTimeout(() => resolve(), timeout); } });}
replicache

Version Info

Tagged at
2 years ago