Rx.Observer.prototype.notifyOn(scheduler)

Schedules the invocation of observer methods on the given scheduler.

参数

  1. scheduler (Scheduler): Scheduler to schedule observer messages on.

返回值

(Observer): Observer whose messages are scheduled on the given scheduler.

Example

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

// Notify on timeout scheduler
var timeoutObserver = observer.notifyOn(Rx.Scheduler.timeout);

timeoutObserver.onNext(42);
// => onNext: 42