source: trip-planner-front/node_modules/rxjs/src/internal/observable/never.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.2 KB
Line 
1import { Observable } from '../Observable';
2import { noop } from '../util/noop';
3
4/**
5 * An Observable that emits no items to the Observer and never completes.
6 *
7 * ![](never.png)
8 *
9 * A simple Observable that emits neither values nor errors nor the completion
10 * notification. It can be used for testing purposes or for composing with other
11 * Observables. Please note that by never emitting a complete notification, this
12 * Observable keeps the subscription from being disposed automatically.
13 * Subscriptions need to be manually disposed.
14 *
15 * ## Example
16 * ### Emit the number 7, then never emit anything else (not even complete)
17 * ```ts
18 * import { NEVER } from 'rxjs';
19 * import { startWith } from 'rxjs/operators';
20 *
21 * function info() {
22 * console.log('Will not be called');
23 * }
24 * const result = NEVER.pipe(startWith(7));
25 * result.subscribe(x => console.log(x), info, info);
26 *
27 * ```
28 *
29 * @see {@link Observable}
30 * @see {@link index/EMPTY}
31 * @see {@link of}
32 * @see {@link throwError}
33 */
34export const NEVER = new Observable<never>(noop);
35
36/**
37 * @deprecated Deprecated in favor of using {@link NEVER} constant.
38 */
39export function never () {
40 return NEVER;
41}
Note: See TracBrowser for help on using the repository browser.