/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ export interface PollingManagerOptions { readonly defaultIntervalMs?: number; } export type ChangeCallback = (change: T) => void; export type StateFetcher = () => Promise>; export type ItemComparator = (a: Item, b: Item) => boolean; export interface ChangePayloadFactory { readonly insert: (item: Item) => ChangePayload; readonly update: (oldItem: Item, newItem: Item) => ChangePayload; readonly delete: (item: Item) => ChangePayload; } export interface PollingSubscriptionOptions { readonly intervalMs?: number; } /** * Consolidates polling subscribers into one polling loop per interval tier so * many subscriptions don't each spin up their own setInterval. */ export declare class PollingSubscriptionManager { private readonly intervals; private lastKnownState; private initialized; /** Guards against poll/init race while the first state fetch is in flight. */ private initializing; private readonly fetchState; private readonly compareItems; private readonly payloadFactory; private readonly defaultIntervalMs; constructor(fetchState: StateFetcher, compareItems: ItemComparator, payloadFactory: ChangePayloadFactory, options?: PollingManagerOptions); subscribe(callback: ChangeCallback, options?: PollingSubscriptionOptions): () => void; private initAndPoll; private pollForNewSubscriber; private poll; get subscriptionCount(): number; get hasSubscriptions(): boolean; destroy(): void; } //# sourceMappingURL=PollingSubscriptionManager.d.ts.map