Created
October 2, 2022 10:38
-
-
Save pazguille/dfd9e692003359ae846ba88d4995a8de to your computer and use it in GitHub Desktop.
requestidlecallback polyfill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.requestIdleCallback = window.requestIdleCallback || function (cb) { | |
var start = Date.now(); | |
return setTimeout(function () { | |
cb({ | |
didTimeout: false, | |
timeRemaining: function () { | |
return Math.max(0, 50 - (Date.now() - start)); | |
} | |
}); | |
}, 1); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment