mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:03:08 +02:00
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 {
|
||||
#renderers: Set<FrameRequestCallback>;
|
||||
#rafId: number;
|
||||
|
|
Loading…
Reference in a new issue