w3c / requestidlecallback

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

Use push/pop or append/take-the-first #45

Closed jyasskin closed 7 years ago

jyasskin commented 8 years ago

https://www.w3.org/TR/requestidlecallback/#dfn-invoke-idle-callbacks-algorithm says "Pop callback from document's Window object's list of runnable idle callbacks.", but other uses of that list say "Append all entries from doclist into runlist preserving order." or "Append callback to window's list of idle request callbacks".

It's not clear whether "pop" means to take the element from the beginning of the list or the end. Using push/pop would make it clear that this is a stack, while append/take-the-first would make it clear that it's a queue.

rmcilroy commented 8 years ago

The intended semantics are that of a queue. I'm don't necessarily think push/pop implies stack semantics (e.g., std::queue uses push/pop), but agree we this could be clearer. How about "pop the first element" (to make it clear the element should be removed)?

igrigorik commented 7 years ago

Looking at the HTML spec: Pop the top element from the stack; Pop the top entry; ...

Push callback to the end of window's list of idle request callbacks... Pop the top callback from document's Window objects...

Does that work?

rmcilroy commented 7 years ago

Works for me :+1: