cancellation-use-cases
cancellation-use-cases copied to clipboard
Linked abort signals task list
Copied from https://github.com/whatwg/dom/issues/920
- [x]
Create explainer skeleton.https://github.com/benjamingr/cancellation-use-cases/tree/main/cancellation - [ ] Add example use cases, including simple code samples so that people get the idea, plus a sketch of more complicated real-world situations.
- [ ] Add description of the problem clearly as illustrated in the use cases.
- [ ] Add comparison with other ecosystems and languages.
- [ ] Add discussion of how people solve this today, and what the drawbacks are.
- [ ] Add comparison between different APIs and their pros/cons and how they would look with the above use cases. Namely:
new AbortController(...signals),new AbortSignal(...signals),AbortSignal.race(signal, otherSignal),signal.follow(otherSignal). - [ ] Add discussion of alternative approaches that would enable implementing this in userland (weak event handlers and
disposeon the signal that removes the listener). - [ ] Set up meeting to discuss the above and invite interested parties to solicit feedback.
Also big thanks to @domenic for this list, roughly taken from here.
Intuitively - when working on this there are several pros and cons:
Pros:
- The use cases here is very compelling and reasonable.
- The problem being worked on is real.
- I am genuinely not sure what the better API is so I am approaching this with a "clean slate". I feel like other people who have expressed interest in this are similarly not sure about the solution - so I'm sure a lot of learning will happen.
Cons:
- I would have preferred third-state cancellation which we will never be able to have since it was shot down by TC39.
- This touches an area a lot of people have strong opinions about.
- There is a reasonable chance this will not result in a new API being added since it requires the solution we come up with providing browsers with enough value for them to prioritize adding it.