NeverObservable.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { Observable } from '../Observable';
  2. import { Subscriber } from '../Subscriber';
  3. /**
  4. * We need this JSDoc comment for affecting ESDoc.
  5. * @extends {Ignored}
  6. * @hide true
  7. */
  8. export declare class NeverObservable<T> extends Observable<T> {
  9. /**
  10. * Creates an Observable that emits no items to the Observer.
  11. *
  12. * <span class="informal">An Observable that never emits anything.</span>
  13. *
  14. * <img src="./img/never.png" width="100%">
  15. *
  16. * This static operator is useful for creating a simple Observable that emits
  17. * neither values nor errors nor the completion notification. It can be used
  18. * for testing purposes or for composing with other Observables. Please note
  19. * that by never emitting a complete notification, this Observable keeps the
  20. * subscription from being disposed automatically. Subscriptions need to be
  21. * manually disposed.
  22. *
  23. * @example <caption>Emit the number 7, then never emit anything else (not even complete).</caption>
  24. * function info() {
  25. * console.log('Will not be called');
  26. * }
  27. * var result = Rx.Observable.never().startWith(7);
  28. * result.subscribe(x => console.log(x), info, info);
  29. *
  30. * @see {@link create}
  31. * @see {@link empty}
  32. * @see {@link of}
  33. * @see {@link throw}
  34. *
  35. * @return {Observable} A "never" Observable: never emits anything.
  36. * @static true
  37. * @name never
  38. * @owner Observable
  39. */
  40. static create<T>(): NeverObservable<T>;
  41. constructor();
  42. /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): void;
  43. }