Debian Codegraph @

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

raw
1 "use strict";
2 var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 if (typeof b !== "function" && b !== null)
11 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12 extendStatics(d, b);
13 function __() { this.constructor = d; }
14 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 };
16 })();
17 Object.defineProperty(exports, "__esModule", { value: true });
18 exports.ColdObservable = void 0;
19 var Observable_1 = require("../Observable");
20 var Subscription_1 = require("../Subscription");
21 var SubscriptionLoggable_1 = require("./SubscriptionLoggable");
22 var applyMixins_1 = require("../util/applyMixins");
23 var Notification_1 = require("../Notification");
24 var ColdObservable = (function (_super) {
25 __extends(ColdObservable, _super);
26 function ColdObservable(messages, scheduler) {
27 var _this = _super.call(this, function (subscriber) {
28 var observable = this;
29 var index = observable.logSubscribedFrame();
30 var subscription = new Subscription_1.Subscription();
31 subscription.add(new Subscription_1.Subscription(function () {
32 observable.logUnsubscribedFrame(index);
33 }));
34 observable.scheduleMessages(subscriber);
35 return subscription;
36 }) || this;
37 _this.messages = messages;
38 _this.subscriptions = [];
39 _this.scheduler = scheduler;
40 return _this;
41 }
42 ColdObservable.prototype.scheduleMessages = function (subscriber) {
43 var messagesLength = this.messages.length;
44 for (var i = 0; i < messagesLength; i++) {
45 var message = this.messages[i];
46 subscriber.add(this.scheduler.schedule(function (state) {
47 var _a = state, notification = _a.message.notification, destination = _a.subscriber;
48 Notification_1.observeNotification(notification, destination);
49 }, message.frame, { message: message, subscriber: subscriber }));
50 }
51 };
52 return ColdObservable;
53 }(Observable_1.Observable));
54 exports.ColdObservable = ColdObservable;
55 applyMixins_1.applyMixins(ColdObservable, [SubscriptionLoggable_1.SubscriptionLoggable]);
56 //# sourceMappingURL=ColdObservable.js.map