a zip code crypto-currency system good for red ONLY

HotObservable.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var Subject_1 = require('../Subject');
  8. var Subscription_1 = require('../Subscription');
  9. var SubscriptionLoggable_1 = require('./SubscriptionLoggable');
  10. var applyMixins_1 = require('../util/applyMixins');
  11. /**
  12. * We need this JSDoc comment for affecting ESDoc.
  13. * @ignore
  14. * @extends {Ignored}
  15. */
  16. var HotObservable = (function (_super) {
  17. __extends(HotObservable, _super);
  18. function HotObservable(messages, scheduler) {
  19. _super.call(this);
  20. this.messages = messages;
  21. this.subscriptions = [];
  22. this.scheduler = scheduler;
  23. }
  24. /** @deprecated internal use only */ HotObservable.prototype._subscribe = function (subscriber) {
  25. var subject = this;
  26. var index = subject.logSubscribedFrame();
  27. subscriber.add(new Subscription_1.Subscription(function () {
  28. subject.logUnsubscribedFrame(index);
  29. }));
  30. return _super.prototype._subscribe.call(this, subscriber);
  31. };
  32. HotObservable.prototype.setup = function () {
  33. var subject = this;
  34. var messagesLength = subject.messages.length;
  35. /* tslint:disable:no-var-keyword */
  36. for (var i = 0; i < messagesLength; i++) {
  37. (function () {
  38. var message = subject.messages[i];
  39. /* tslint:enable */
  40. subject.scheduler.schedule(function () { message.notification.observe(subject); }, message.frame);
  41. })();
  42. }
  43. };
  44. return HotObservable;
  45. }(Subject_1.Subject));
  46. exports.HotObservable = HotObservable;
  47. applyMixins_1.applyMixins(HotObservable, [SubscriptionLoggable_1.SubscriptionLoggable]);
  48. //# sourceMappingURL=HotObservable.js.map