mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
This pr is trying to split `web` and `electron` entries from `core`. It allows more platform-related optimization to be addressed in each entry. We should remove all browser/electron only codes from `core` eventually, this is the very first step for that.
20 lines
419 B
TypeScript
20 lines
419 B
TypeScript
window.requestIdleCallback =
|
|
window.requestIdleCallback ||
|
|
function (cb) {
|
|
const start = Date.now();
|
|
return setTimeout(function () {
|
|
cb({
|
|
didTimeout: false,
|
|
timeRemaining: function () {
|
|
return Math.max(0, 50 - (Date.now() - start));
|
|
},
|
|
});
|
|
}, 1);
|
|
};
|
|
|
|
window.cancelIdleCallback =
|
|
window.cancelIdleCallback ||
|
|
function (id) {
|
|
clearTimeout(id);
|
|
};
|