Front end of the Slack clone application.

materialize.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { materialize as higherOrder } from '../operators/materialize';
  2. /**
  3. * Represents all of the notifications from the source Observable as `next`
  4. * emissions marked with their original types within {@link Notification}
  5. * objects.
  6. *
  7. * <span class="informal">Wraps `next`, `error` and `complete` emissions in
  8. * {@link Notification} objects, emitted as `next` on the output Observable.
  9. * </span>
  10. *
  11. * <img src="./img/materialize.png" width="100%">
  12. *
  13. * `materialize` returns an Observable that emits a `next` notification for each
  14. * `next`, `error`, or `complete` emission of the source Observable. When the
  15. * source Observable emits `complete`, the output Observable will emit `next` as
  16. * a Notification of type "complete", and then it will emit `complete` as well.
  17. * When the source Observable emits `error`, the output will emit `next` as a
  18. * Notification of type "error", and then `complete`.
  19. *
  20. * This operator is useful for producing metadata of the source Observable, to
  21. * be consumed as `next` emissions. Use it in conjunction with
  22. * {@link dematerialize}.
  23. *
  24. * @example <caption>Convert a faulty Observable to an Observable of Notifications</caption>
  25. * var letters = Rx.Observable.of('a', 'b', 13, 'd');
  26. * var upperCase = letters.map(x => x.toUpperCase());
  27. * var materialized = upperCase.materialize();
  28. * materialized.subscribe(x => console.log(x));
  29. *
  30. * // Results in the following:
  31. * // - Notification {kind: "N", value: "A", error: undefined, hasValue: true}
  32. * // - Notification {kind: "N", value: "B", error: undefined, hasValue: true}
  33. * // - Notification {kind: "E", value: undefined, error: TypeError:
  34. * // x.toUpperCase is not a function at MapSubscriber.letters.map.x
  35. * // [as project] (http://1…, hasValue: false}
  36. *
  37. * @see {@link Notification}
  38. * @see {@link dematerialize}
  39. *
  40. * @return {Observable<Notification<T>>} An Observable that emits
  41. * {@link Notification} objects that wrap the original emissions from the source
  42. * Observable with metadata.
  43. * @method materialize
  44. * @owner Observable
  45. */
  46. export function materialize() {
  47. return higherOrder()(this);
  48. }
  49. //# sourceMappingURL=materialize.js.map