Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

race.d.ts 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Observable } from '../Observable';
  2. import { Operator } from '../Operator';
  3. import { Subscriber } from '../Subscriber';
  4. import { TeardownLogic } from '../types';
  5. import { OuterSubscriber } from '../OuterSubscriber';
  6. import { InnerSubscriber } from '../InnerSubscriber';
  7. /**
  8. * Returns an Observable that mirrors the first source Observable to emit an item.
  9. *
  10. * ## Example
  11. * ### Subscribes to the observable that was the first to start emitting.
  12. *
  13. * ```javascript
  14. * const obs1 = interval(1000).pipe(mapTo('fast one'));
  15. * const obs2 = interval(3000).pipe(mapTo('medium one'));
  16. * const obs3 = interval(5000).pipe(mapTo('slow one'));
  17. *
  18. * race(obs3, obs1, obs2)
  19. * .subscribe(
  20. * winner => console.log(winner)
  21. * );
  22. *
  23. * // result:
  24. * // a series of 'fast one'
  25. * ```
  26. *
  27. * @param {...Observables} ...observables sources used to race for which Observable emits first.
  28. * @return {Observable} an Observable that mirrors the output of the first Observable to emit an item.
  29. * @static true
  30. * @name race
  31. * @owner Observable
  32. */
  33. export declare function race<T>(observables: Array<Observable<T>>): Observable<T>;
  34. export declare function race<T>(observables: Array<Observable<any>>): Observable<T>;
  35. export declare function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): Observable<T>;
  36. export declare class RaceOperator<T> implements Operator<T, T> {
  37. call(subscriber: Subscriber<T>, source: any): TeardownLogic;
  38. }
  39. /**
  40. * We need this JSDoc comment for affecting ESDoc.
  41. * @ignore
  42. * @extends {Ignored}
  43. */
  44. export declare class RaceSubscriber<T> extends OuterSubscriber<T, T> {
  45. private hasFirst;
  46. private observables;
  47. private subscriptions;
  48. constructor(destination: Subscriber<T>);
  49. protected _next(observable: any): void;
  50. protected _complete(): void;
  51. notifyNext(outerValue: T, innerValue: T, outerIndex: number, innerIndex: number, innerSub: InnerSubscriber<T, T>): void;
  52. }