a zip code crypto-currency system good for red ONLY

HotObservable.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Subject } from '../Subject';
  2. import { Subscription } from '../Subscription';
  3. import { SubscriptionLoggable } from './SubscriptionLoggable';
  4. import { applyMixins } from '../util/applyMixins';
  5. /**
  6. * We need this JSDoc comment for affecting ESDoc.
  7. * @ignore
  8. * @extends {Ignored}
  9. */
  10. export class HotObservable extends Subject {
  11. constructor(messages, scheduler) {
  12. super();
  13. this.messages = messages;
  14. this.subscriptions = [];
  15. this.scheduler = scheduler;
  16. }
  17. /** @deprecated internal use only */ _subscribe(subscriber) {
  18. const subject = this;
  19. const index = subject.logSubscribedFrame();
  20. subscriber.add(new Subscription(() => {
  21. subject.logUnsubscribedFrame(index);
  22. }));
  23. return super._subscribe(subscriber);
  24. }
  25. setup() {
  26. const subject = this;
  27. const messagesLength = subject.messages.length;
  28. /* tslint:disable:no-var-keyword */
  29. for (var i = 0; i < messagesLength; i++) {
  30. (() => {
  31. var message = subject.messages[i];
  32. /* tslint:enable */
  33. subject.scheduler.schedule(() => { message.notification.observe(subject); }, message.frame);
  34. })();
  35. }
  36. }
  37. }
  38. applyMixins(HotObservable, [SubscriptionLoggable]);
  39. //# sourceMappingURL=HotObservable.js.map