Skip to content

Commit

Permalink
Merge pull request #59 from Brightspace/dbatiste/use-core-requestIdle…
Browse files Browse the repository at this point in the history
…Callback

Use requestIdleCallback from core.
  • Loading branch information
dbatiste authored Aug 29, 2019
2 parents 7165748 + 4a21a98 commit 1038aa9
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions requestIdleCallback.js
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
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);
};

window.cancelIdleCallback = window.cancelIdleCallback || function(id) {
clearTimeout(id);
};
import '@brightspace-ui/core/helpers/requestIdleCallback.js';

0 comments on commit 1038aa9

Please sign in to comment.