Closed igrigorik closed 8 years ago
If you move the runnable queue you'll probably want to clear it on every navigation. Otherwise enqueued idle callbacks will run even after the page that enqueued them has been navigated away from.
On a second pass, I think I'm over complicating this.. I'll tackle #29 as a separate issue.
@domenic @rmcilroy I've updated the pull to focus on document -> window fix. Please take another look, I think it should be ready to go.
LGTM, thanks!
Great! @domenic any comments or objections before I merge this?
@bzbarsky @domenic thanks for the corrections, looks like I thoroughly confused myself there. Updated, please take another pass.
Looks good with an editorial concern.
Just as a sanity check: I assume this is actually implemented in Chrome via a map stored on the window object? Not, e.g., stored on the event loop or similar?
Yes, that looks much better.
Re Domanic's comment - on Chrome it is stored in a HashMap which lives (via a ScriptedIdleTaskController, then a Document object) on a LocalDOMWindow object.
Thanks everyone. Updated, squashed, merging.
Took another run at it. Not 100% clear if I'm heading in the right direction though...
Preview: https://cdn.rawgit.com/w3c/requestidlecallback/window/index.html
Thoughts / comments?