empty
signature: empty(scheduler: Scheduler): Observable
Observable that immediately completes.
Examples
Example 1: empty immediately completes
import { empty } from 'rxjs/observable/empty';
//Create observable that immediately completes
const example = empty();
//output: 'Complete!'
const subscribe = example.subscribe({
next: () => console.log('Next'),
complete: () => console.log('Complete!')
});
Follow the Source Code
Coming soon…
Additional Resources
- empty
- Official docs - Creation operators: empty, never, and throw
- André Staltz
Source Code:
https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/EmptyObservable.ts