Packages@robojs/sync
DIRECTORY
API reference for @robojs/sync
@robojs/sync
API reference documentation for @robojs/sync.
Interfaces
CallResult- Result of an RPC call.Client- Represents a connected client in a sync context.CursorOptions- Options for useSyncCursor hook.CursorPosition- Cursor position data.CursorResult- Result returned by useSyncCursor hook.DragBounds- Bounds configuration for draggable elements.DragOptions- Options for useSyncDrag hook.DragResult- Result returned by useSyncDrag hook.DragState- Base state shape for draggable elements.HandlerClient- Client info available in handler contexts.LockContext- Lock context for lockable SyncBox.MessagePayloadParticipant- Represents a participant in the presence system.PresenceOptions- Options for useSyncPresence hook.PresenceResult- Result returned by useSyncPresence hook.RemoteCursor- Represents a remote cursor with client info.SchemaField- Built-in schema field definition.SchemaValidationResult- Schema validation result.ServerZone- Server-side zone handle for direct state manipulation.SetStateOptions- Options for setState calls.SyncBoxHandle- Imperative handle for SyncBox ref.SyncBoxProps- Props for SyncBox component.SyncBroadcastResult- Result object returned by useSyncBroadcast hook.SyncCallContext- Context passed to RPC call handlers.SyncContextOptions- Options for useSyncContext hook callbacks.SyncContext- Context object returned by useSyncState, useSyncContext, and useSyncBroadcast.SyncCursorsProps- Props for SyncCursors component.SyncDraggableProps- Props for SyncDraggable component.SyncDraggableRenderProps- Render props for SyncDraggable children.SyncHandlerModule- A sync handler module can export any combination of these.SyncHandlerRecord- Resolved handler record from manifest.SyncMiddlewareContext- Context passed to middleware handlers.SyncMiddlewareModule- A middleware module exports before and/or after hooks.SyncMiddlewareRecord- Middleware record from manifest.SyncStatus- Sync status for SyncBox components.SyncUpdateContext- Context passed to validation and transform handlers.SyncZoneProps- Props for SyncZone component.ZoneContextValue- Context value provided by SyncZone to its children.
Type Aliases
BroadcastCallbackBuiltInSchema- Built-in schema definition (alternative to Zod).CallHandler- RPC call handler function.ConnectionStatus- Connection status for zones and sync components.ContextCallbackContextEvent- Internal callback types for context management.InterpolateConfig- Interpolation config for smooth remote state updates.MessageTypeMiddlewareAfterHandler- Middleware 'after' handler.MiddlewareBeforeHandler- Middleware 'before' handler.MiddlewareResult- Result from middleware 'before' handler.OnUpdateHandler- Post-update callback.SyncBoxRenderFunction- Render function signature for SyncBox children.SyncBoxSetState- setState function signature with options support.SyncCallFunction- The call function type returned by useSyncCall.ThrottleConfig- Throttle config - either a single number or per-field config.TransformHandler- Transform function - modify state before broadcasting.ValidateHandler- Validation function - return true to accept, false or string to reject.
Functions
ClearHandlers- Clear all registered handlers (for testing).GetHandlerCount- Get handler count (for debugging).GetMiddlewareCount- Get middleware count (for debugging).RegisterHandler- Register a sync handler from manifest.RegisterMiddleware- Register middleware from manifest.SyncBox- A synced container component that synchronizes arbitrary state across clients.SyncContextProviderSyncCursors- Pre-built component that renders all participant cursors automatically.SyncDraggable- Declarative component wrapper for making any element draggable and synchronized.SyncZone- A context provider that establishes a sync zone with key prefix inheritance.UseSyncBroadcast- Hook for sending and receiving ephemeral broadcasts in a sync room.UseSyncCall- Hook for making RPC calls to server-side sync handlers.UseSyncContext- Hook to access the sync context for a given key/room.UseSyncCursor- Hook for tracking and broadcasting cursor positions in real-time.UseSyncDrag- Hook for creating draggable elements with synchronized positions.UseSyncPresence- Hook for tracking participant presence with arbitrary metadata.UseSyncState- Hook for synchronized state across clients.UseZoneContext- Hook to access the current zone context.UseZoneKey- Hook to compute the full key by combining zone prefix with a local id.
Variables
SyncServerZoneContext- Context for zone prefix inheritance.
