Skip to content
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

Observable#subscribe w/ callbacks #257

Closed
arcanis opened this issue Nov 3, 2016 · 4 comments
Closed

Observable#subscribe w/ callbacks #257

arcanis opened this issue Nov 3, 2016 · 4 comments
Labels

Comments

@arcanis
Copy link

arcanis commented Nov 3, 2016

The current Observable proposal allows two different ways to call subscribe: with an observer object, or via callbacks. The later doesn't seem to be supported by Core-js.

// Subscribes to the sequence with an observer
subscribe(observer : Observer) : Subscription;

// Subscribes to the sequence with callbacks
subscribe(onNext : Function, onError? : Function, onComplete? : Function) : Subscription;
@zloirock
Copy link
Owner

zloirock commented Nov 4, 2016

Some months ago Observable proposal was updated with some breaking changes. But we can't update it in core-js right now - it's breaking changes. It will be updated in next major version.

@zloirock zloirock added the esnext label Nov 4, 2016
@fbuecklers
Copy link

Is that really API breaking changes? I See it more like an API addition.
I have currently patched the core-js implementation with the following code:

var sub = Observable.prototype.subscribe;
Observable.prototype.subscribe = function(onNext, onError, onComplete) {
  if (onNext instanceof Function) {
    return sub.call(this, {
      next: onNext,
      error: onError,
      complete: onComplete
    });
  } else {
    return sub.call(this, onNext);
  }
};

Or do im miss somthing here right now?

@zloirock
Copy link
Owner

zloirock commented Nov 8, 2016

For example, in Observable#forEach - it's just removed.

@zloirock
Copy link
Owner

zloirock commented Dec 8, 2017

Added to v3 branch.

@zloirock zloirock closed this as completed Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants