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.

ColdObservable.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /** PURE_IMPORTS_START tslib,_Observable,_Subscription,_SubscriptionLoggable,_util_applyMixins PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Observable } from '../Observable';
  4. import { Subscription } from '../Subscription';
  5. import { SubscriptionLoggable } from './SubscriptionLoggable';
  6. import { applyMixins } from '../util/applyMixins';
  7. var ColdObservable = /*@__PURE__*/ (function (_super) {
  8. tslib_1.__extends(ColdObservable, _super);
  9. function ColdObservable(messages, scheduler) {
  10. var _this = _super.call(this, function (subscriber) {
  11. var observable = this;
  12. var index = observable.logSubscribedFrame();
  13. var subscription = new Subscription();
  14. subscription.add(new Subscription(function () {
  15. observable.logUnsubscribedFrame(index);
  16. }));
  17. observable.scheduleMessages(subscriber);
  18. return subscription;
  19. }) || this;
  20. _this.messages = messages;
  21. _this.subscriptions = [];
  22. _this.scheduler = scheduler;
  23. return _this;
  24. }
  25. ColdObservable.prototype.scheduleMessages = function (subscriber) {
  26. var messagesLength = this.messages.length;
  27. for (var i = 0; i < messagesLength; i++) {
  28. var message = this.messages[i];
  29. subscriber.add(this.scheduler.schedule(function (_a) {
  30. var message = _a.message, subscriber = _a.subscriber;
  31. message.notification.observe(subscriber);
  32. }, message.frame, { message: message, subscriber: subscriber }));
  33. }
  34. };
  35. return ColdObservable;
  36. }(Observable));
  37. export { ColdObservable };
  38. /*@__PURE__*/ applyMixins(ColdObservable, [SubscriptionLoggable]);
  39. //# sourceMappingURL=ColdObservable.js.map