import Controller from '../controller/Controller.js'; import { Manager, Middleware, UnsubscribeAction, SubscribeAction } from '../types.js'; type Actions = UnsubscribeAction | SubscribeAction; /** Interface handling a single resource subscription */ export interface Subscription { add(frequency?: number): void; remove(frequency?: number): boolean; cleanup(): void; } /** The static class that constructs Subscription */ export interface SubscriptionConstructable { new (action: Pick>, controller: Controller): Subscription; } /** Handles subscription actions -> fetch or set actions * * Constructor takes a SubscriptionConstructable class to control how * subscriptions are handled. (e.g., polling, websockets) * * @see https://dataclient.io/docs/api/SubscriptionManager */ export default class SubscriptionManager implements Manager { protected subscriptions: { [key: string]: InstanceType; }; protected readonly Subscription: S; protected controller: Controller; constructor(Subscription: S); middleware: Middleware; /** Ensures all subscriptions are cleaned up. */ cleanup(): void; /** Called when middleware intercepts 'rdc/subscribe' action. * */ protected handleSubscribe(action: SubscribeAction): void; /** Called when middleware intercepts 'rdc/unsubscribe' action. * */ protected handleUnsubscribe(action: UnsubscribeAction): void; } export {}; //# sourceMappingURL=SubscriptionManager.d.ts.map