Event loops in navigated-away-from windows
ian at hixie.ch
Mon Sep 29 11:18:36 PDT 2014
On Sat, 27 Sep 2014, Anne van Kesteren wrote:
> Well, I for one find it confusing that while HTML had a fairly worked
> out event loop concept, ECMAScript added another and now I somehow
> mentally need to integrate them. It would be way clearer if ECMAScript
> just queued tasks/jobs/microtasks to the Host so we'd keep a single
> concept of a loop.
Allen and I discussed how they should be integrated, and the long and
short of it is that there's only one event loop; HTML just interrupts the
ES6 loop at NextJob step 4 (the "implementation defined manner"), and
resumes the HTML event loop, and when the HTML event loop needs to resume
running code, it resumes the NextJob algorithm. That and a few other hooks
ensures that all the jobs end up as tasks and all the ordering semantics
The discussion was at:
I haven't yet done this in HTML because I'm waiting for Allen to make the
changes he talked about in that thread; this is being tracked here:
Once that's done I can update HTML. (I don't want to update HTML before,
because otherwise I'll have to do it twice.)
The HTML bug for this is:
I certainly wouldn't object to the ES spec's event loop algorithms being
turned inside out (search for "RunCode" on the esdiscuss thread above for
an e-mail where I propose this) but that would be purely an editorial
change, it wouldn't change the implementations.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the es-discuss