Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

dematerialize.d.ts 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Notification } from '../Notification';
  2. import { OperatorFunction } from '../types';
  3. /**
  4. * Converts an Observable of {@link Notification} objects into the emissions
  5. * that they represent.
  6. *
  7. * <span class="informal">Unwraps {@link Notification} objects as actual `next`,
  8. * `error` and `complete` emissions. The opposite of {@link materialize}.</span>
  9. *
  10. * ![](dematerialize.png)
  11. *
  12. * `dematerialize` is assumed to operate an Observable that only emits
  13. * {@link Notification} objects as `next` emissions, and does not emit any
  14. * `error`. Such Observable is the output of a `materialize` operation. Those
  15. * notifications are then unwrapped using the metadata they contain, and emitted
  16. * as `next`, `error`, and `complete` on the output Observable.
  17. *
  18. * Use this operator in conjunction with {@link materialize}.
  19. *
  20. * ## Example
  21. * Convert an Observable of Notifications to an actual Observable
  22. * ```ts
  23. * import { of, Notification } from 'rxjs';
  24. * import { dematerialize } from 'rxjs/operators';
  25. *
  26. * const notifA = new Notification('N', 'A');
  27. * const notifB = new Notification('N', 'B');
  28. * const notifE = new Notification('E', undefined,
  29. * new TypeError('x.toUpperCase is not a function')
  30. * );
  31. * const materialized = of(notifA, notifB, notifE);
  32. * const upperCase = materialized.pipe(dematerialize());
  33. * upperCase.subscribe(x => console.log(x), e => console.error(e));
  34. *
  35. * // Results in:
  36. * // A
  37. * // B
  38. * // TypeError: x.toUpperCase is not a function
  39. * ```
  40. *
  41. * @see {@link Notification}
  42. * @see {@link materialize}
  43. *
  44. * @return {Observable} An Observable that emits items and notifications
  45. * embedded in Notification objects emitted by the source Observable.
  46. * @method dematerialize
  47. * @owner Observable
  48. */
  49. export declare function dematerialize<T>(): OperatorFunction<Notification<T>, T>;