source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/observeOn.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import { Subscriber } from '../Subscriber';
2import { Notification } from '../Notification';
3export function observeOn(scheduler, delay = 0) {
4 return function observeOnOperatorFunction(source) {
5 return source.lift(new ObserveOnOperator(scheduler, delay));
6 };
7}
8export class ObserveOnOperator {
9 constructor(scheduler, delay = 0) {
10 this.scheduler = scheduler;
11 this.delay = delay;
12 }
13 call(subscriber, source) {
14 return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
15 }
16}
17export class ObserveOnSubscriber extends Subscriber {
18 constructor(destination, scheduler, delay = 0) {
19 super(destination);
20 this.scheduler = scheduler;
21 this.delay = delay;
22 }
23 static dispatch(arg) {
24 const { notification, destination } = arg;
25 notification.observe(destination);
26 this.unsubscribe();
27 }
28 scheduleMessage(notification) {
29 const destination = this.destination;
30 destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
31 }
32 _next(value) {
33 this.scheduleMessage(Notification.createNext(value));
34 }
35 _error(err) {
36 this.scheduleMessage(Notification.createError(err));
37 this.unsubscribe();
38 }
39 _complete() {
40 this.scheduleMessage(Notification.createComplete());
41 this.unsubscribe();
42 }
43}
44export class ObserveOnMessage {
45 constructor(notification, destination) {
46 this.notification = notification;
47 this.destination = destination;
48 }
49}
50//# sourceMappingURL=observeOn.js.map
Note: See TracBrowser for help on using the repository browser.