Front end of the Slack clone application.

ErrorObservable.d.ts 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { IScheduler } from '../Scheduler';
  2. import { Observable } from '../Observable';
  3. import { TeardownLogic } from '../Subscription';
  4. import { Subscriber } from '../Subscriber';
  5. export interface DispatchArg {
  6. error: any;
  7. subscriber: any;
  8. }
  9. /**
  10. * We need this JSDoc comment for affecting ESDoc.
  11. * @extends {Ignored}
  12. * @hide true
  13. */
  14. export declare class ErrorObservable extends Observable<any> {
  15. error: any;
  16. private scheduler;
  17. /**
  18. * Creates an Observable that emits no items to the Observer and immediately
  19. * emits an error notification.
  20. *
  21. * <span class="informal">Just emits 'error', and nothing else.
  22. * </span>
  23. *
  24. * <img src="./img/throw.png" width="100%">
  25. *
  26. * This static operator is useful for creating a simple Observable that only
  27. * emits the error notification. It can be used for composing with other
  28. * Observables, such as in a {@link mergeMap}.
  29. *
  30. * @example <caption>Emit the number 7, then emit an error.</caption>
  31. * var result = Rx.Observable.throw(new Error('oops!')).startWith(7);
  32. * result.subscribe(x => console.log(x), e => console.error(e));
  33. *
  34. * @example <caption>Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>
  35. * var interval = Rx.Observable.interval(1000);
  36. * var result = interval.mergeMap(x =>
  37. * x === 13 ?
  38. * Rx.Observable.throw('Thirteens are bad') :
  39. * Rx.Observable.of('a', 'b', 'c')
  40. * );
  41. * result.subscribe(x => console.log(x), e => console.error(e));
  42. *
  43. * @see {@link create}
  44. * @see {@link empty}
  45. * @see {@link never}
  46. * @see {@link of}
  47. *
  48. * @param {any} error The particular Error to pass to the error notification.
  49. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
  50. * the emission of the error notification.
  51. * @return {Observable} An error Observable: emits only the error notification
  52. * using the given error argument.
  53. * @static true
  54. * @name throw
  55. * @owner Observable
  56. */
  57. static create(error: any, scheduler?: IScheduler): ErrorObservable;
  58. static dispatch(arg: DispatchArg): void;
  59. constructor(error: any, scheduler?: IScheduler);
  60. /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<any>): TeardownLogic;
  61. }