mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-01 08:18:51 +09: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,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 New Issue
Block a user