Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
window.requestIdleCallback =
window.requestIdleCallback ||
function(cb) {
function(cb, options) {
var options = options || {};
var timeout = options.timeout || 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually used as the timeout.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think we have to implement all options in polyfill

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the point of the timeout to change the timeout argument given to setTimeout?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code always say to callback didTimeout is false, but that is not correct

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do you any questions? or you are not sure about this PR

var start = Date.now();
return setTimeout(function() {
cb({
didTimeout: false,
get didTimeout() {
return options.timeout ? false : (Date.now() - start) > timeout;
},
timeRemaining: function() {
return Math.max(0, 50 - (Date.now() - start));
},
Expand Down