UNPKG

porter-source

Version:

Messaging Library for Web Extensions

27 lines (26 loc) 929 B
import { Runtime } from 'webextension-polyfill'; import { AgentInfo } from '../porter.model'; import { Logger } from '../porter.utils'; export declare class AgentConnectionManager { private readonly namespace; private readonly CONNECTION_TIMEOUT; private readonly RECONNECT_INTERVAL; private connectionTimer; private reconnectTimer; private agentInfo; private port; private readonly logger; private readonly connectionId; private readonly messageQueue; private isReconnecting; private reconnectAttemptCount; constructor(namespace: string, logger: Logger); initializeConnection(): Promise<void>; private processQueuedMessages; getPort(): Runtime.Port | null; getAgentInfo(): AgentInfo | null; getNamespace(): string; handleDisconnect(port: Runtime.Port): void; private startReconnectionAttempts; queueMessage(message: any, target?: any): void; }