2022-01-21 08:28:41 +00:00
|
|
|
import { Observable } from '../Observable';
|
|
|
|
/**
|
|
|
|
* An Observable that emits no items to the Observer and never completes.
|
|
|
|
*
|
|
|
|
* ![](never.png)
|
|
|
|
*
|
|
|
|
* A simple Observable that emits neither values nor errors nor the completion
|
|
|
|
* notification. It can be used for testing purposes or for composing with other
|
|
|
|
* Observables. Please note that by never emitting a complete notification, this
|
|
|
|
* Observable keeps the subscription from being disposed automatically.
|
|
|
|
* Subscriptions need to be manually disposed.
|
|
|
|
*
|
|
|
|
* ## Example
|
2022-05-29 09:24:36 +00:00
|
|
|
* ### Emit the number 7, then never emit anything else (not even complete)
|
2022-01-21 08:28:41 +00:00
|
|
|
* ```ts
|
2022-05-29 09:24:36 +00:00
|
|
|
* import { NEVER } from 'rxjs';
|
|
|
|
* import { startWith } from 'rxjs/operators';
|
2022-01-21 08:28:41 +00:00
|
|
|
*
|
2022-05-29 09:24:36 +00:00
|
|
|
* function info() {
|
|
|
|
* console.log('Will not be called');
|
|
|
|
* }
|
2022-04-07 07:06:43 +00:00
|
|
|
* const result = NEVER.pipe(startWith(7));
|
2022-05-29 09:24:36 +00:00
|
|
|
* result.subscribe(x => console.log(x), info, info);
|
|
|
|
*
|
2022-01-21 08:28:41 +00:00
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @see {@link Observable}
|
2022-05-29 09:24:36 +00:00
|
|
|
* @see {@link index/EMPTY}
|
2022-01-21 08:28:41 +00:00
|
|
|
* @see {@link of}
|
|
|
|
* @see {@link throwError}
|
|
|
|
*/
|
|
|
|
export declare const NEVER: Observable<never>;
|
|
|
|
/**
|
2022-05-29 09:24:36 +00:00
|
|
|
* @deprecated Deprecated in favor of using {@link NEVER} constant.
|
2022-01-21 08:28:41 +00:00
|
|
|
*/
|
|
|
|
export declare function never(): Observable<never>;
|