w3c / requestidlecallback

Cooperative Scheduling of Background Tasks
https://w3c.github.io/requestidlecallback/
Other
50 stars 19 forks source link

Future-proof the rIC API and make it extensible #21

Closed igrigorik closed 8 years ago

igrigorik commented 8 years ago
requestIdleCallback(IdleRequestCallback callback, optional unsigned long timeout);

Problem: Current API signature takes an optional timeout value, which makes it impossible to extend this API in the future with other optional or required parameters.

Proposal: move timeout into an optional dictionary…

requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options);

dictionary IdleRequestOptions {
             optional unsigned long timeout;
};
rmcilroy commented 8 years ago

SGTM. @toddreifsteck, any objections?

igrigorik commented 8 years ago

/cc @eliperelman @bzbarsky

bzbarsky commented 8 years ago

If you really wanted to, you could even support both:

requestIdleCallback(IdleRequestCallback callback, unsigned long timeout);
requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options);

No idea whether you want that. Just having the dictionary is probably fine.

igrigorik commented 8 years ago

FWIW, given that we're working with clean slate here, I'd vote for dictionary only -- reduces confusion.

eliperelman commented 8 years ago

@igrigorik no objections. I'm also fine with dictionary-only.

rmcilroy commented 8 years ago

Change uploaded to address this in #22

toddreifsteck commented 8 years ago

Perfect! LGTM

igrigorik commented 8 years ago

Resolved via #22, closing.