import type { EndpointInterface } from '@data-client/normalizr';
import ConnectionListener from './ConnectionListener.js';
import type { Subscription } from './SubscriptionManager.js';
import type Controller from '../controller/Controller.js';
import type { SubscribeAction } from '../types.js';
/**
 * PollingSubscription keeps a given resource updated by
 * dispatching a fetch at a rate equal to the minimum update
 * interval requested.
 *
 * @see https://dataclient.io/docs/api/PollingSubscription
 */
export default class PollingSubscription implements Subscription {
    protected readonly endpoint: EndpointInterface;
    protected readonly args: readonly any[];
    protected readonly key: string;
    protected frequency: number;
    protected frequencyHistogram: Map<number, number>;
    protected controller: Controller;
    protected intervalId?: ReturnType<typeof setInterval>;
    protected lastIntervalId?: ReturnType<typeof setInterval>;
    protected startId?: ReturnType<typeof setTimeout>;
    private connectionListener;
    constructor(action: Omit<SubscribeAction, 'type'>, controller: Controller, connectionListener?: ConnectionListener);
    /** Subscribe to a frequency */
    add(frequency?: number): void;
    /** Unsubscribe from a frequency */
    remove(frequency?: number): boolean;
    /** Cleanup means clearing out background interval. */
    cleanup(): void;
    /** Trigger request for latest resource */
    protected update(): void;
    /** What happens when browser goes offline */
    protected offlineListener: () => void;
    /** What happens when browser comes online */
    protected onlineListener: () => void;
    /** Run polling process with current frequency
     *
     * Will clean up old poll interval on next run
     */
    protected run(): void;
    /** Last fetch time */
    protected lastFetchTime(): number;
}
//# sourceMappingURL=PollingSubscription.d.ts.map