Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

"waiting" as state or orthogonal concept? #10

Open
inexorabletash opened this issue Sep 13, 2016 · 0 comments
Open

"waiting" as state or orthogonal concept? #10

inexorabletash opened this issue Sep 13, 2016 · 0 comments

Comments

@inexorabletash
Copy link
Owner

As hinted at in #9 the state transitions are complicated. If all waiting promises resolve while performing event firing (which will dispatch to a target, execute microtasks, dispatch to the next target, execute more microtasks, etc) the state should flip to "active" not "inactive". There are a few ways to do this:

  • Track an additional "is dispatching" flag
  • Add "waiting-active" and "waiting-inactive"
  • Drop "waiting" entirely as a state, and use "has unresolved waiting promises" as the thing which holds the tx open
  • Don't exit "waiting" until a subsequent turn of the event loop so that all target dispatches/microtasks will see it as "waiting".

I have this prototyped with the first (an "is dispatching" flag) but it feels wrong. I'm thinking about dropping "waiting" as an actual state. And if that's the case should we eliminate the .state property?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant