import { Subscriber } from '../Subscriber'; import { Subscription } from '../Subscription'; import { Observable } from '../Observable'; import { Subject } from '../Subject'; /** * Groups the items emitted by an Observable according to a specified criterion, * and emits these grouped items as `GroupedObservables`, one * {@link GroupedObservable} per group. * * * * @param {function(value: T): K} keySelector a function that extracts the key * for each item. * @param {function(value: T): R} [elementSelector] a function that extracts the * return element for each item. * @param {function(grouped: GroupedObservable): Observable} [durationSelector] * a function that returns an Observable to determine how long each group should * exist. * @return {Observable>} an Observable that emits * GroupedObservables, each of which corresponds to a unique key value and each * of which emits those items from the source Observable that share that key * value. * @method groupBy * @owner Observable */ export declare function groupBy(keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable) => Observable): Observable>; export interface GroupBySignature { (keySelector: (value: T) => K): Observable>; (keySelector: (value: T) => K, elementSelector: void, durationSelector: (grouped: GroupedObservable) => Observable): Observable>; (keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable) => Observable): Observable>; } export interface RefCountSubscription { count: number; unsubscribe: () => void; closed: boolean; attemptedToUnsubscribe: boolean; } /** * An Observable representing values belonging to the same group represented by * a common key. The values emitted by a GroupedObservable come from the source * Observable. The common key is available as the field `key` on a * GroupedObservable instance. * * @class GroupedObservable */ export declare class GroupedObservable extends Observable { key: K; private groupSubject; private refCountSubscription; constructor(key: K, groupSubject: Subject, refCountSubscription?: RefCountSubscription); protected _subscribe(subscriber: Subscriber): Subscription; }