claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
101 lines • 2.69 kB
TypeScript
export class YjsWebSocketProvider {
constructor(config?: {});
config: {
serverUrl: any;
reconnectInterval: any;
maxReconnectAttempts: any;
heartbeatInterval: any;
};
providers: Map<any, any>;
documents: Map<any, any>;
awareness: Map<any, any>;
reconnectAttempts: Map<any, any>;
connectionStates: Map<any, any>;
eventHandlers: Map<any, any>;
userId: any;
userInfo: any;
listeners: {};
isOnline: boolean;
/**
* Connect to a block's collaborative session
*/
connectToBlock(blockId: any, options?: {}): Promise<any>;
/**
* Disconnect from a block's collaborative session
*/
disconnectFromBlock(blockId: any): void;
/**
* Get the Y.Doc for a specific block
*/
getDocument(blockId: any): any;
/**
* Get the awareness instance for a specific block
*/
getAwareness(blockId: any): any;
/**
* Get connection state for a block
*/
getConnectionState(blockId: any): any;
/**
* Update user awareness information
*/
updateAwareness(blockId: any, updates: any): void;
/**
* Set cursor position for a block
*/
setCursor(blockId: any, cursor: any): void;
/**
* Set selection range for a block
*/
setSelection(blockId: any, selection: any): void;
/**
* Get all connected users for a block
*/
getConnectedUsers(blockId: any): any[];
/**
* Setup event listeners for a block's provider and document
*/
setupBlockEventListeners(blockId: any, provider: any, ydoc: any): void;
/**
* Handle automatic reconnection for a block
*/
handleReconnection(blockId: any): Promise<void>;
/**
* Setup network connectivity listeners
*/
setupNetworkListeners(): void;
_networkListeners: {
handleOnline: () => void;
handleOffline: () => void;
} | undefined;
/**
* Get statistics about all connections
*/
getStats(): {
totalBlocks: number;
connectedBlocks: number;
syncedBlocks: number;
totalUsers: number;
isOnline: boolean;
};
/**
* Disconnect from all blocks and cleanup
*/
destroy(): void;
/**
* Simple event emitter implementation
*/
emit(event: any, data: any): void;
on(event: any, callback: any): void;
off(event: any, callback: any): void;
/**
* Generate a unique user ID
*/
generateUserId(): string;
/**
* Generate a random user color
*/
generateUserColor(): string;
}
export default YjsWebSocketProvider;
//# sourceMappingURL=YjsWebSocketProvider.d.ts.map