Skip to content

Commit

Permalink
Check if requestIdleCallback exists in window (#112)
Browse files Browse the repository at this point in the history
Fixes the following error when not transpiled:
> Uncaught ReferenceError: Cannot access 'requestIdleCallback' before initialization
>   at request-idle-callback.mjs:18
  • Loading branch information
dieulot authored and addyosmani committed Aug 6, 2019
1 parent 32e5b61 commit 089da91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/request-idle-callback.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
**/

// RIC and shim for browsers setTimeout() without it
const requestIdleCallback = requestIdleCallback ||
const requestIdleCallback = window.requestIdleCallback ||
function (cb) {
const start = Date.now();
return setTimeout(function () {
Expand Down

0 comments on commit 089da91

Please sign in to comment.