empty

signature: empty(scheduler: Scheduler): Observable

Observable that immediately completes.

empty - 图1

Examples

Example 1: empty immediately completes

( jsBin |
jsFiddle )

  1. import { empty } from 'rxjs/observable/empty';
  2. //Create observable that immediately completes
  3. const example = empty();
  4. //output: 'Complete!'
  5. const subscribe = example.subscribe({
  6. next: () => console.log('Next'),
  7. complete: () => console.log('Complete!')
  8. });

Follow the Source Code

Coming soon…

Additional Resources


:file_folder: Source Code:
https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/EmptyObservable.ts