import { SignalService } from "@session.js/types/signal-bindings"; import { type Storage } from "@session.js/types/storage"; import { SnodeNamespaces } from "@session.js/types/namespaces"; import type { EnvelopePlus } from "@session.js/types/envelope"; import type { Swarm } from "@session.js/types/swarm"; import type { Session } from "../instance/index.js"; type InstanceMethodsForPoller = { onMessagesReceived: (messages: { hash: string; envelope: EnvelopePlus; content: SignalService.Content; }[]) => void; updateLastHashes: (hashes: { namespace: SnodeNamespaces; lastHash: string; }[]) => void; storage: Storage; onSwarmConnectionFailed: (swarm: Swarm) => Swarm | undefined; }; export declare class Poller { private interval; private polling; private instance; private methods; private intervalId; private namespaces; /** * New poller of messages for Session instance. Starts polling as soon as attached to instance of interval is not null, call stopPolling to stop automatic polling and startPolling to resume. * @param interval — Polling interval in milliseconds, must either be integer > 0. Set to null to disable automatic polling. Default is 3000ms. */ constructor(options?: { interval?: number | null; namespaces?: Set; }); /** @private */ _attachedToInstance(instance: Session, methods: InstanceMethodsForPoller): void; /** Manually resumes auto-polling. Does nothing if `interval` of Poller is null */ startPolling(): void; /** Stops auto-polling. Does nothing if `interval` of Poller is null */ stopPolling(): void; setInterval(interval: number | null): void; /** Return if this Poller is set to poll automatically */ isPolling(): boolean; private getLastHashes; /** Trigger manual messages polling */ poll(): Promise<{ hash: string; envelope: EnvelopePlus; content: SignalService.Content; }[]>; } export {};