groupBy.d.ts 1.8KB

12345678910111213141516171819202122232425262728293031
  1. import { Subscriber } from '../Subscriber';
  2. import { Subscription } from '../Subscription';
  3. import { Observable } from '../Observable';
  4. import { Subject } from '../Subject';
  5. import { OperatorFunction } from '../interfaces';
  6. export declare function groupBy<T, K>(keySelector: (value: T) => K): OperatorFunction<T, GroupedObservable<K, T>>;
  7. export declare function groupBy<T, K>(keySelector: (value: T) => K, elementSelector: void, durationSelector: (grouped: GroupedObservable<K, T>) => Observable<any>): OperatorFunction<T, GroupedObservable<K, T>>;
  8. export declare function groupBy<T, K, R>(keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>): OperatorFunction<T, GroupedObservable<K, R>>;
  9. export declare function groupBy<T, K, R>(keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>, subjectSelector?: () => Subject<R>): OperatorFunction<T, GroupedObservable<K, R>>;
  10. export interface RefCountSubscription {
  11. count: number;
  12. unsubscribe: () => void;
  13. closed: boolean;
  14. attemptedToUnsubscribe: boolean;
  15. }
  16. /**
  17. * An Observable representing values belonging to the same group represented by
  18. * a common key. The values emitted by a GroupedObservable come from the source
  19. * Observable. The common key is available as the field `key` on a
  20. * GroupedObservable instance.
  21. *
  22. * @class GroupedObservable<K, T>
  23. */
  24. export declare class GroupedObservable<K, T> extends Observable<T> {
  25. key: K;
  26. private groupSubject;
  27. private refCountSubscription;
  28. constructor(key: K, groupSubject: Subject<T>, refCountSubscription?: RefCountSubscription);
  29. /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription;
  30. }