| 1 |
import { __extends } from "tslib"; |
| 2 |
import { Subject } from '../Subject'; |
| 3 |
import { Subscription } from '../Subscription'; |
| 4 |
import { SubscriptionLoggable } from './SubscriptionLoggable'; |
| 5 |
import { applyMixins } from '../util/applyMixins'; |
| 6 |
import { observeNotification } from '../Notification'; |
| 7 |
var HotObservable = (function (_super) { |
| 8 |
__extends(HotObservable, _super); |
| 9 |
function HotObservable(messages, scheduler) { |
| 10 |
var _this = _super.call(this) || this; |
| 11 |
_this.messages = messages; |
| 12 |
_this.subscriptions = []; |
| 13 |
_this.scheduler = scheduler; |
| 14 |
return _this; |
| 15 |
} |
| 16 |
HotObservable.prototype._subscribe = function (subscriber) { |
| 17 |
var subject = this; |
| 18 |
var index = subject.logSubscribedFrame(); |
| 19 |
var subscription = new Subscription(); |
| 20 |
subscription.add(new Subscription(function () { |
| 21 |
subject.logUnsubscribedFrame(index); |
| 22 |
})); |
| 23 |
subscription.add(_super.prototype._subscribe.call(this, subscriber)); |
| 24 |
return subscription; |
| 25 |
}; |
| 26 |
HotObservable.prototype.setup = function () { |
| 27 |
var subject = this; |
| 28 |
var messagesLength = subject.messages.length; |
| 29 |
var _loop_1 = function (i) { |
| 30 |
(function () { |
| 31 |
var _a = subject.messages[i], notification = _a.notification, frame = _a.frame; |
| 32 |
subject.scheduler.schedule(function () { |
| 33 |
observeNotification(notification, subject); |
| 34 |
}, frame); |
| 35 |
})(); |
| 36 |
}; |
| 37 |
for (var i = 0; i < messagesLength; i++) { |
| 38 |
_loop_1(i); |
| 39 |
} |
| 40 |
}; |
| 41 |
return HotObservable; |
| 42 |
}(Subject)); |
| 43 |
export { HotObservable }; |
| 44 |
applyMixins(HotObservable, [SubscriptionLoggable]); |
| 45 |
//# sourceMappingURL=HotObservable.js.map |