Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HotObservable.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /** PURE_IMPORTS_START tslib,_Subject,_Subscription,_SubscriptionLoggable,_util_applyMixins PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Subject } from '../Subject';
  4. import { Subscription } from '../Subscription';
  5. import { SubscriptionLoggable } from './SubscriptionLoggable';
  6. import { applyMixins } from '../util/applyMixins';
  7. var HotObservable = /*@__PURE__*/ (function (_super) {
  8. tslib_1.__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. for (var i = 0; i < messagesLength; i++) {
  30. (function () {
  31. var message = subject.messages[i];
  32. subject.scheduler.schedule(function () { message.notification.observe(subject); }, message.frame);
  33. })();
  34. }
  35. };
  36. return HotObservable;
  37. }(Subject));
  38. export { HotObservable };
  39. /*@__PURE__*/ applyMixins(HotObservable, [SubscriptionLoggable]);
  40. //# sourceMappingURL=HotObservable.js.map