Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

materialize.d.ts 2.1KB

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