a zip code crypto-currency system good for red ONLY

BehaviorSubject.js 950B

123456789101112131415161718192021222324252627282930313233343536
  1. import { Subject } from './Subject';
  2. import { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';
  3. /**
  4. * @class BehaviorSubject<T>
  5. */
  6. export class BehaviorSubject extends Subject {
  7. constructor(_value) {
  8. super();
  9. this._value = _value;
  10. }
  11. get value() {
  12. return this.getValue();
  13. }
  14. /** @deprecated internal use only */ _subscribe(subscriber) {
  15. const subscription = super._subscribe(subscriber);
  16. if (subscription && !subscription.closed) {
  17. subscriber.next(this._value);
  18. }
  19. return subscription;
  20. }
  21. getValue() {
  22. if (this.hasError) {
  23. throw this.thrownError;
  24. }
  25. else if (this.closed) {
  26. throw new ObjectUnsubscribedError();
  27. }
  28. else {
  29. return this._value;
  30. }
  31. }
  32. next(value) {
  33. super.next(this._value = value);
  34. }
  35. }
  36. //# sourceMappingURL=BehaviorSubject.js.map