Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidance on events and promises #119

Closed
marcoscaceres opened this issue Feb 5, 2019 · 4 comments
Closed

Guidance on events and promises #119

marcoscaceres opened this issue Feb 5, 2019 · 4 comments

Comments

@marcoscaceres
Copy link
Contributor

An issue came up recently in for the Screen Orientation lock API where by we have a promise being resolved and event being dispatched due to some action (the screen locking to a new orientation, which can trigger a "change" event).

The question that came up is:

The closest the Promise Guide comes to providing guidance is in the "one time events" section. My reading of that section is that the event should fire fist, and then the promise is resolved based on that action (e.g., "the image loaded, .then(...)", "the orientation locked, .then(...)" and so on).

@annevk
Copy link
Member

annevk commented Feb 5, 2019

Yeah, queue a task to

  1. Dispatch the event.
  2. Resolve the promise.

@marcoscaceres
Copy link
Contributor Author

Worth amending The Guide? Might avoid a situation like happened with Screen Orientation (now causing issues downstream).

@annevk
Copy link
Member

annevk commented Feb 5, 2019

https://www.w3.org/2001/tag/doc/promises-guide#queue-tasks goes into it, though is also partially wrong in suggesting you can avoid queuing tasks.

I'd add advice like this to https://w3ctag.github.io/design-principles/#event-design somewhere as this promises guide needs to have its useful bits folded into IDL and then go away...

@marcoscaceres
Copy link
Contributor Author

@kenchris, or someone on the TAG with sufficient privileges, could you please transfer this bug to the design guide?

@ylafon ylafon transferred this issue from w3ctag/promises-guide Feb 6, 2019
kenchris added a commit to kenchris/design-principles that referenced this issue Feb 7, 2019
kenchris added a commit to kenchris/design-principles that referenced this issue Feb 7, 2019
@kenchris kenchris reopened this Feb 7, 2019
kenchris added a commit to kenchris/design-principles that referenced this issue Feb 7, 2019
kenchris added a commit to kenchris/design-principles that referenced this issue Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants