Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | import { Observable } from '../Observable';
|
---|
| 2 | /**
|
---|
| 3 | * An Observable that emits no items to the Observer and never completes.
|
---|
| 4 | *
|
---|
| 5 | * ![](never.png)
|
---|
| 6 | *
|
---|
| 7 | * A simple Observable that emits neither values nor errors nor the completion
|
---|
| 8 | * notification. It can be used for testing purposes or for composing with other
|
---|
| 9 | * Observables. Please note that by never emitting a complete notification, this
|
---|
| 10 | * Observable keeps the subscription from being disposed automatically.
|
---|
| 11 | * Subscriptions need to be manually disposed.
|
---|
| 12 | *
|
---|
| 13 | * ## Example
|
---|
| 14 | * ### Emit the number 7, then never emit anything else (not even complete)
|
---|
| 15 | * ```ts
|
---|
| 16 | * import { NEVER } from 'rxjs';
|
---|
| 17 | * import { startWith } from 'rxjs/operators';
|
---|
| 18 | *
|
---|
| 19 | * function info() {
|
---|
| 20 | * console.log('Will not be called');
|
---|
| 21 | * }
|
---|
| 22 | * const result = NEVER.pipe(startWith(7));
|
---|
| 23 | * result.subscribe(x => console.log(x), info, info);
|
---|
| 24 | *
|
---|
| 25 | * ```
|
---|
| 26 | *
|
---|
| 27 | * @see {@link Observable}
|
---|
| 28 | * @see {@link index/EMPTY}
|
---|
| 29 | * @see {@link of}
|
---|
| 30 | * @see {@link throwError}
|
---|
| 31 | */
|
---|
| 32 | export declare const NEVER: Observable<never>;
|
---|
| 33 | /**
|
---|
| 34 | * @deprecated Deprecated in favor of using {@link NEVER} constant.
|
---|
| 35 | */
|
---|
| 36 | export declare function never(): Observable<never>;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.