react-mirrorstate
Version:
React library for bidirectional state synchronization with MirrorState
21 lines (20 loc) • 633 B
TypeScript
type StateListener = (state: any) => void;
declare class WebSocketConnectionManager {
private ws;
private isConnecting;
private listeners;
private currentStates;
private lastSeq;
private queuedUpdates;
private getWebSocketConfig;
private buildWebSocketURL;
private cleanup;
connect(): Promise<void>;
subscribe(name: string, listener: StateListener): () => void;
private pendingUpdates;
updateState(name: string, state: any): void;
getCurrentState(name: string): any;
private notifyListeners;
}
export declare const connectionManager: WebSocketConnectionManager;
export {};