Re: [whatwg/dom] Improving ergonomics of events with Observable (#544)

It might be better if `first` is named `toPromise`. This is how we handle conversion of observable to promise in RxJS (although the implementation is a bit different). It's useful as an interop point for APIs that expect promises, such as async-await, however the name is either just unattractive enough or just specific enough that people don't often use it as a means to subscribe to observable unless they actually need it. That wouldn't put us in much different of a situation than someone organically using `Promise.resolve` inside of an `addEventListener`. The name is fairly explicit, so people will definitely know they're dealing with a Promise.

Then again, the presence of a `then` method is a solid cue that a Promise is being used, and that microtask scheduling is at play. So the behavior will not likely be too surprising to anyone familiar with promises.

I am with @jhusain that the promise-related methods are not the most important part of this proposal. However, it would be really nice to get some interop for async-await and other api's that expect promises.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/544#issuecomment-351918668

Received on Friday, 15 December 2017 05:40:49 UTC