Debian Codegraph @

node/rxjs/dist/esm/internal/testing/ColdObservable.js

raw
1 import { Observable } from '../Observable';
2 import { Subscription } from '../Subscription';
3 import { SubscriptionLoggable } from './SubscriptionLoggable';
4 import { applyMixins } from '../util/applyMixins';
5 import { observeNotification } from '../Notification';
6 export class ColdObservable extends Observable {
7 constructor(messages, scheduler) {
8 super(function (subscriber) {
9 const observable = this;
10 const index = observable.logSubscribedFrame();
11 const subscription = new Subscription();
12 subscription.add(new Subscription(() => {
13 observable.logUnsubscribedFrame(index);
14 }));
15 observable.scheduleMessages(subscriber);
16 return subscription;
17 });
18 this.messages = messages;
19 this.subscriptions = [];
20 this.scheduler = scheduler;
21 }
22 scheduleMessages(subscriber) {
23 const messagesLength = this.messages.length;
24 for (let i = 0; i < messagesLength; i++) {
25 const message = this.messages[i];
26 subscriber.add(this.scheduler.schedule((state) => {
27 const { message: { notification }, subscriber: destination } = state;
28 observeNotification(notification, destination);
29 }, message.frame, { message, subscriber }));
30 }
31 }
32 }
33 applyMixins(ColdObservable, [SubscriptionLoggable]);
34 //# sourceMappingURL=ColdObservable.js.map