window.requestIdleCallback
window.requestIdleCallback()
方法将在浏览器的空闲时段内调用的函数排队。// 解决兼容
requestIdleCallback(callback, options) {
if (window.requestIdleCallback) {
return window.requestIdleCallback(callback, options);
} else {
return setTimeout(callback, options.timeout);
}
}