This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm2015/internal/testing/ColdObservable.js
2019-08-11 20:48:02 +02:00

30 lines
No EOL
1.3 KiB
JavaScript

import { Observable } from '../Observable';
import { Subscription } from '../Subscription';
import { SubscriptionLoggable } from './SubscriptionLoggable';
import { applyMixins } from '../util/applyMixins';
export class ColdObservable extends Observable {
constructor(messages, scheduler) {
super(function (subscriber) {
const observable = this;
const index = observable.logSubscribedFrame();
const subscription = new Subscription();
subscription.add(new Subscription(() => {
observable.logUnsubscribedFrame(index);
}));
observable.scheduleMessages(subscriber);
return subscription;
});
this.messages = messages;
this.subscriptions = [];
this.scheduler = scheduler;
}
scheduleMessages(subscriber) {
const messagesLength = this.messages.length;
for (let i = 0; i < messagesLength; i++) {
const message = this.messages[i];
subscriber.add(this.scheduler.schedule(({ message, subscriber }) => { message.notification.observe(subscriber); }, message.frame, { message, subscriber }));
}
}
}
applyMixins(ColdObservable, [SubscriptionLoggable]);
//# sourceMappingURL=ColdObservable.js.map