mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
16 lines
377 B
TypeScript
16 lines
377 B
TypeScript
const requestIdleCallback =
|
|
window.requestIdleCallback ||
|
|
function requestIdleCallbackPolyfill(cb) {
|
|
const start = Date.now();
|
|
return setTimeout(function () {
|
|
cb({
|
|
didTimeout: false,
|
|
timeRemaining: function () {
|
|
return Math.max(0, 50 - (Date.now() - start));
|
|
},
|
|
});
|
|
}, 1);
|
|
};
|
|
|
|
export default requestIdleCallback;
|