UNPKG

@veltdev/types

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

116 lines (100 loc) 3.46 kB
// @ts-nocheck export declare class CrdtElement { /** * Update data for a specific CRDT document * @param id Document ID * @param state State data as Uint8Array or number array */ updateData: ({ id, state }: { id: string, state: Uint8Array | number[] }) => Promise<any>; /** * Subscribe to data changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle data changes * @returns Unsubscribe function */ onDataChange: ({ id, callback }: { id: string, callback: (data: any) => void }) => () => void; /** * Get data for a specific CRDT document * @param id Document ID */ getData: ({ id }: { id: string }) => Promise<any>; /** * Subscribe to state changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle state changes * @returns Unsubscribe function */ onStateChange: ({ id, callback }: { id: string, callback: (data: any) => void }) => () => void; /** * Update state for a specific CRDT document * @param id Document ID * @param state State data as Uint8Array or number array */ updateState: ({ id, state }: { id: string, state: Uint8Array | number[] }) => Promise<any>; /** * Register a user for synchronization on a specific CRDT document * @param id Document ID */ registerSyncUser: ({ id }: { id: string }) => Promise<void>; /** * Set presence for a specific CRDT document * @param id Document ID */ setPresence: ({ id }: { id: string }) => Promise<void>; /** * Subscribe to presence changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle presence changes * @returns Unsubscribe function */ onPresenceChange: ({ id, callback }: { id: string, callback: (data: any) => void }) => () => void; constructor(); /** * Update data for a specific CRDT document * @param id Document ID * @param state State data as Uint8Array or number array */ private _updateData; /** * Subscribe to data changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle data changes * @returns Unsubscribe function */ private _onDataChange; /** * Get data for a specific CRDT document * @param id Document ID */ private _getData; /** * Subscribe to state changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle state changes * @returns Unsubscribe function */ private _onStateChange; /** * Update state for a specific CRDT document * @param id Document ID * @param state State data as Uint8Array or number array */ private _updateState; /** * Register a user for synchronization on a specific CRDT document * @param id Document ID */ private _registerSyncUser; /** * Set presence for a specific CRDT document * @param id Document ID */ private _setPresence; /** * Subscribe to presence changes for a specific CRDT document * @param id Document ID * @param callback Callback function to handle presence changes * @returns Unsubscribe function */ private _onPresenceChange; }