tc39 / proposal-observable

Observables for ECMAScript
https://tc39.github.io/proposal-observable/
3.06k stars 90 forks source link

Updating subscribe params #146

Closed jakearchibald closed 7 years ago

appsforartists commented 7 years ago

@jakearchibald I think you've confused the Observer API and the positional API.

I believe subscribe(next, error, complete) and subscribe({ next, error, complete }) are both being proposed; the latter interface (with the named arguments) is called an Observer and is already specified in the method above the one you've edited. You can see the shape of Observer towards the bottom of the README.

benjamingr commented 7 years ago

@appsforartists this is just the argument names, so when you .toString it you get friendlier names in the reference implementation. Not an API change.

jakearchibald commented 7 years ago

@appsforartists you're right, I didn't realise that the positional form was also supported.

Maybe the README could be updated to explain this? The definition of .subscribe suggests that only the positional form works, whereas all the examples use the observer form.

appsforartists commented 7 years ago

It would definitely be more clear if they introduced Observer before Observable. I'm neither in TC39 nor an editor to this repo, so I have no expertise on spec text. Maybe @jhusain would accept a PR changing the order?

appsforartists commented 7 years ago

@benjamingr I know positional argument names don't matter - just trying to help Jake understand the subscribe API. 😃