import { EndpointInterface } from '@data-client/normalizr'; import ConnectionListener from './ConnectionListener.js'; import { Subscription } from './SubscriptionManager.js'; import Controller from '../controller/Controller.js'; import { 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; protected controller: Controller; protected intervalId?: ReturnType; protected lastIntervalId?: ReturnType; protected startId?: ReturnType; private connectionListener; constructor(action: Pick>, 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