Rx.Observer.prototype.toNotifier()

Creates a notification callback from an observer.

返回值

(Function): The function that forwards its input notification to the underlying observer.

Example

var observer = Rx.Observer.create(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));

var notifier = observer.toNotifier();

// Invoke with onNext
notifier(Rx.Notification.createOnNext(42));
// => onNext: 42

// Invoke with onCompleted
notifier(Rx.Notification.createOnCompleted());
// => onCompleted