fix: response to experimental rIC support on Safari removed due to Google Login bug?
This commit is contained in:
parent
561683f097
commit
a87dd5ddec
1 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
const requestIdleCallback: typeof globalThis.requestIdleCallback = globalThis.requestIdleCallback ?? (callback) => {
|
||||||
|
const start = performance.now();
|
||||||
|
const timeoutId = setTimeout(() => {
|
||||||
|
callback({
|
||||||
|
didTimeout: false, // polyfill でタイムアウト発火することはない
|
||||||
|
timeRemaining() {
|
||||||
|
const diff = performance.now() - start;
|
||||||
|
return Math.max(0, 50 - diff); // <https://www.w3.org/TR/requestidlecallback/#idle-periods>
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return timeoutId;
|
||||||
|
};
|
||||||
|
const cancelIdleCallback: typeof globalThis.cancelIdleCallback = globalThis.cancelIdleCallback ?? (timeoutId) => {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
};
|
||||||
|
|
||||||
class IdlingRenderScheduler {
|
class IdlingRenderScheduler {
|
||||||
#renderers: Set<FrameRequestCallback>;
|
#renderers: Set<FrameRequestCallback>;
|
||||||
#rafId: number;
|
#rafId: number;
|
||||||
|
|
Loading…
Reference in a new issue