1 import { Subscriber } from '../Subscriber';
2 import { Notification } from '../Notification';
3 export function observeOn(scheduler, delay = 0) {
4 return function observeOnOperatorFunction(source) {
5 return source.lift(new ObserveOnOperator(scheduler, delay));
8 export class ObserveOnOperator {
9 constructor(scheduler, delay = 0) {
10 this.scheduler = scheduler;
13 call(subscriber, source) {
14 return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
17 export class ObserveOnSubscriber extends Subscriber {
18 constructor(destination, scheduler, delay = 0) {
20 this.scheduler = scheduler;
23 static dispatch(arg) {
24 const { notification, destination } = arg;
25 notification.observe(destination);
28 scheduleMessage(notification) {
29 const destination = this.destination;
30 destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
33 this.scheduleMessage(Notification.createNext(value));
36 this.scheduleMessage(Notification.createError(err));
40 this.scheduleMessage(Notification.createComplete());
44 export class ObserveOnMessage {
45 constructor(notification, destination) {
46 this.notification = notification;
47 this.destination = destination;
50 //# sourceMappingURL=observeOn.js.map