source: trip-planner-front/node_modules/rxjs/internal/operators/materialize.d.ts@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1import { Notification } from '../Notification';
2import { 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 * ```ts
28 * import { of } from 'rxjs';
29 * import { materialize, map } from 'rxjs/operators';
30 *
31 * const letters = of('a', 'b', 13, 'd');
32 * const upperCase = letters.pipe(map(x => x.toUpperCase()));
33 * const materialized = upperCase.pipe(materialize());
34 * materialized.subscribe(x => console.log(x));
35 *
36 * // Results in the following:
37 * // - Notification {kind: "N", value: "A", error: undefined, hasValue: true}
38 * // - Notification {kind: "N", value: "B", error: undefined, hasValue: true}
39 * // - Notification {kind: "E", value: undefined, error: TypeError:
40 * // x.toUpperCase is not a function at MapSubscriber.letters.map.x
41 * // [as project] (http://1…, hasValue: false}
42 * ```
43 *
44 * @see {@link Notification}
45 * @see {@link dematerialize}
46 *
47 * @return {Observable<Notification<T>>} An Observable that emits
48 * {@link Notification} objects that wrap the original emissions from the source
49 * Observable with metadata.
50 * @method materialize
51 * @owner Observable
52 */
53export declare function materialize<T>(): OperatorFunction<T, Notification<T>>;
Note: See TracBrowser for help on using the repository browser.