source: trip-planner-front/node_modules/rxjs/internal/operators/publishLast.d.ts

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

initial commit

  • Property mode set to 100644
File size: 1.9 KB
Line 
1import { Observable } from '../Observable';
2import { ConnectableObservable } from '../observable/ConnectableObservable';
3import { UnaryFunction } from '../types';
4/**
5 * Returns a connectable observable sequence that shares a single subscription to the
6 * underlying sequence containing only the last notification.
7 *
8 * ![](publishLast.png)
9 *
10 * Similar to {@link publish}, but it waits until the source observable completes and stores
11 * the last emitted value.
12 * Similarly to {@link publishReplay} and {@link publishBehavior}, this keeps storing the last
13 * value even if it has no more subscribers. If subsequent subscriptions happen, they will
14 * immediately get that last stored value and complete.
15 *
16 * ## Example
17 *
18 * ```ts
19 * import { interval } from 'rxjs';
20 * import { publishLast, tap, take } from 'rxjs/operators';
21 *
22 * const connectable =
23 * interval(1000)
24 * .pipe(
25 * tap(x => console.log("side effect", x)),
26 * take(3),
27 * publishLast());
28 *
29 * connectable.subscribe(
30 * x => console.log( "Sub. A", x),
31 * err => console.log("Sub. A Error", err),
32 * () => console.log( "Sub. A Complete"));
33 *
34 * connectable.subscribe(
35 * x => console.log( "Sub. B", x),
36 * err => console.log("Sub. B Error", err),
37 * () => console.log( "Sub. B Complete"));
38 *
39 * connectable.connect();
40 *
41 * // Results:
42 * // "side effect 0"
43 * // "side effect 1"
44 * // "side effect 2"
45 * // "Sub. A 2"
46 * // "Sub. B 2"
47 * // "Sub. A Complete"
48 * // "Sub. B Complete"
49 * ```
50 *
51 * @see {@link ConnectableObservable}
52 * @see {@link publish}
53 * @see {@link publishReplay}
54 * @see {@link publishBehavior}
55 *
56 * @return {ConnectableObservable} An observable sequence that contains the elements of a
57 * sequence produced by multicasting the source sequence.
58 * @method publishLast
59 * @owner Observable
60 */
61export declare function publishLast<T>(): UnaryFunction<Observable<T>, ConnectableObservable<T>>;
Note: See TracBrowser for help on using the repository browser.