Open tbondwilkinson opened 1 year ago
One justification here is that methods that return Promise instead of Observable shouldn't be as easily chainable in the same way.
I'm not sure I understand the reasoning behind this sentence. Why shouldn't they be as easily chainable?
+1 to @tabatkins's comment. I'm not sure I understand what's undesirable about:
observable
.every(() => { ... })
.then(() => { ... })
.then(() => { ... })
?
One of the things that was discussed at TPAC was the issues around doing this:
observable.find(() => true).then(([e]) => {
e.stopPropagation(); // OOPS! Too late because promise scheduling :(
});
It's probably better to have all of these return an Observable.
The forEach
function can still return a Promise
, but the handler it has can be synchronously invoked.
The other option would be to add these methods to be static methods on
Observable
or evenPromise
.One justification here is that methods that return
Promise
instead ofObservable
shouldn't be as easily chainable in the same way.