a zip code crypto-currency system good for red ONLY

share.js 939B

1234567891011121314151617181920212223
  1. import { multicast } from './multicast';
  2. import { refCount } from './refCount';
  3. import { Subject } from '../Subject';
  4. function shareSubjectFactory() {
  5. return new Subject();
  6. }
  7. /**
  8. * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
  9. * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
  10. * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
  11. * This is an alias for .multicast(() => new Subject()).refCount().
  12. *
  13. * <img src="./img/share.png" width="100%">
  14. *
  15. * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
  16. * @method share
  17. * @owner Observable
  18. */
  19. export function share() {
  20. return (source) => refCount()(multicast(shareSubjectFactory)(source));
  21. }
  22. ;
  23. //# sourceMappingURL=share.js.map