source: trip-planner-front/node_modules/rxjs/internal/operators/isEmpty.d.ts@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1import { OperatorFunction } from '../types';
2/**
3 * Emits false if the input observable emits any values, or emits true if the
4 * input observable completes without emitting any values.
5 *
6 * <span class="informal">Tells whether any values are emitted by an observable</span>
7 *
8 * ![](isEmpty.png)
9 *
10 * `isEmpty` transforms an Observable that emits values into an Observable that
11 * emits a single boolean value representing whether or not any values were
12 * emitted by the source Observable. As soon as the source Observable emits a
13 * value, `isEmpty` will emit a `false` and complete. If the source Observable
14 * completes having not emitted anything, `isEmpty` will emit a `true` and
15 * complete.
16 *
17 * A similar effect could be achieved with {@link count}, but `isEmpty` can emit
18 * a `false` value sooner.
19 *
20 * ## Examples
21 *
22 * Emit `false` for a non-empty Observable
23 * ```javascript
24 * import { Subject } from 'rxjs';
25 * import { isEmpty } from 'rxjs/operators';
26 *
27 * const source = new Subject<string>();
28 * const result = source.pipe(isEmpty());
29 * source.subscribe(x => console.log(x));
30 * result.subscribe(x => console.log(x));
31 * source.next('a');
32 * source.next('b');
33 * source.next('c');
34 * source.complete();
35 *
36 * // Results in:
37 * // a
38 * // false
39 * // b
40 * // c
41 * ```
42 *
43 * Emit `true` for an empty Observable
44 * ```javascript
45 * import { EMPTY } from 'rxjs';
46 * import { isEmpty } from 'rxjs/operators';
47 *
48 * const result = EMPTY.pipe(isEmpty());
49 * result.subscribe(x => console.log(x));
50 * // Results in:
51 * // true
52 * ```
53 *
54 * @see {@link count}
55 * @see {@link EMPTY}
56 *
57 * @return {OperatorFunction<T, boolean>} An Observable of a boolean value indicating whether observable was empty or not
58 * @method isEmpty
59 * @owner Observable
60 */
61export declare function isEmpty<T>(): OperatorFunction<T, boolean>;
Note: See TracBrowser for help on using the repository browser.