-
Notifications
You must be signed in to change notification settings - Fork 90
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
obs.subscribe(next, error, complete)
should bind their callbacks to undefined
when present
#194
Comments
Oh, and BTW, this is an area where implementations differ:
|
Well, honestly I always aw observables as: class Observable {
constructor(subscribe) { this.subscribe = subscribe; }
} Which is a "minimal observable implementation" (just a function reference I can call to). In that scenario when calling That said, I don't recall ever using it in any way ever. |
@benjamingr Neither do I, and personally, I wouldn't miss it if that 3-argument prototype disappeared from the spec altogether. It's not like very many have it - most implementations that don't try to implement the spec don't even bother to implement the 3-argument variant, just the one. |
I think the only times I've used it were in toy examples. The problem with it is that it's not obvious from first sight which one's |
Considering the observer variant is effectively named args, I don't see a need at all for the 3 arg variant: $.subscribe({
next(value) {...},
complete() {...},
error(error) {...},
}) is a more readable/easier to understand alternative that's already supported. |
It seems odd and inconsistent for them to have a
this
that's:undefined
like pretty much everything elsePretty much everything else in the language binds things to
undefined
where necessary when a function is passed as a clear non-method, so why shouldn't this?The text was updated successfully, but these errors were encountered: