AbstractProtectedcanvasFabric.js canvas instance
ProtectedcontextWhiteboard context
Optional ReadonlydescriptionDescription
Whether the add-in is currently enabled
Optional ReadonlyiconIcon (optional)
ReadonlyidUnique add-in ID
ReadonlynameDisplay name
ProtectedbroadcastBroadcast a message to other users
Data to broadcast
Create an object of a specific type Override to implement custom object creation
Object type
Creation options
Export add-in data for saving Override to save custom add-in state
ProtectedfindFind an add-in object by its ID
Object ID to find
ProtectedforceForce whiteboard to re-render
ProtectedgenerateGenerate a unique object ID for this add-in
ProtectedgetGet all objects belonging to this add-in
Get context menu items for a selected object Override to provide custom context menu items
Selected object
ProtectedgetGet current drawing color
ProtectedgetGet a debounced broadcast function for a specific object Useful for batching frequent updates (e.g., text editing)
Object ID for debouncing
Debounce delay in milliseconds
Get object types this add-in handles Override to specify custom object types
Get toolbar buttons to add to the whiteboard toolbar Override to provide custom toolbar buttons
ProtectedgetGet current user ID
Import add-in data on load Override to restore custom add-in state
Data to import
Check if an object belongs to this add-in
Object to check
ProtectedisCheck if in read-only mode
Called when a message is received from another user Override to handle incoming messages
Called when the add-in is mounted/enabled Override to perform initialization
Called when an object is added to the canvas Override to handle object additions
Called when an object is loaded from a saved file Override to handle object loading (e.g., restore event handlers)
Called when an object is modified on the canvas Override to handle object modifications
Called when an object is removed from the canvas Override to handle object removals
Called when selection changes Override to handle selection changes
Called when the add-in is unmounted/disabled Override to perform cleanup
Base class for whiteboard add-ins
Add-ins extend whiteboard functionality with custom tools, objects, and behaviors. Each add-in has access to the canvas and can broadcast messages to other users.
Example