提交 ba16f6c1 编写于 作者: J Johannes Rieken

requestIdle - less warning

上级 a2898d57
......@@ -709,8 +709,12 @@ declare module global {
}
(function () {
if (!global.requestIdleCallback || !global.cancelIdleCallback) {
console.warn('requestIdleCallback not available. using fallback');
let warned = false;
runWhenIdle = (runner, timeout?) => {
if (!warned) {
console.warn('requestIdleCallback not available. using fallback');
warned = true;
}
let handle = setTimeout(() => runner({ didTimeout: true, timeRemaining() { return Number.MAX_VALUE; } }), timeout);
return { dispose() { clearTimeout(handle); } };
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册