44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
0 && (module.exports = {
|
||
|
requestIdleCallback: null,
|
||
|
cancelIdleCallback: null
|
||
|
});
|
||
|
function _export(target, all) {
|
||
|
for(var name in all)Object.defineProperty(target, name, {
|
||
|
enumerable: true,
|
||
|
get: all[name]
|
||
|
});
|
||
|
}
|
||
|
_export(exports, {
|
||
|
requestIdleCallback: function() {
|
||
|
return requestIdleCallback;
|
||
|
},
|
||
|
cancelIdleCallback: function() {
|
||
|
return cancelIdleCallback;
|
||
|
}
|
||
|
});
|
||
|
const requestIdleCallback = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
|
||
|
let start = Date.now();
|
||
|
return self.setTimeout(function() {
|
||
|
cb({
|
||
|
didTimeout: false,
|
||
|
timeRemaining: function() {
|
||
|
return Math.max(0, 50 - (Date.now() - start));
|
||
|
}
|
||
|
});
|
||
|
}, 1);
|
||
|
};
|
||
|
const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
|
||
|
return clearTimeout(id);
|
||
|
};
|
||
|
|
||
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||
|
Object.assign(exports.default, exports);
|
||
|
module.exports = exports.default;
|
||
|
}
|
||
|
|
||
|
//# sourceMappingURL=request-idle-callback.js.map
|