Hiyve Components - v1.0.0
    Preparing search index...

    Class WhiteboardAddinAbstract

    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.

    class StickyNotesAddin extends WhiteboardAddin {
    constructor() {
    super({
    id: 'sticky-notes',
    name: 'Sticky Notes',
    description: 'Add colorful sticky notes to the whiteboard',
    });
    }

    getToolbarButtons(): ToolbarButton[] {
    return [{
    id: 'add-sticky',
    label: 'Add Sticky Note',
    icon: <NoteAddIcon />,
    action: () => this.addStickyNote(),
    }];
    }

    getObjectTypes(): string[] {
    return ['sticky-note'];
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    canvas: Canvas | null = null

    Fabric.js canvas instance

    context: WhiteboardAddinContext | null = null

    Whiteboard context

    description?: string

    Description

    enabled: boolean = false

    Whether the add-in is currently enabled

    icon?: ReactNode

    Icon (optional)

    id: string

    Unique add-in ID

    name: string

    Display name

    Methods

    • Create an object of a specific type Override to implement custom object creation

      Parameters

      • _type: string

        Object type

      • _options: Record<string, unknown>

        Creation options

      Returns
          | FabricObject<
              Partial<FabricObjectProps>,
              SerializedObjectProps,
              ObjectEvents,
          >
          | null

    • Get a debounced broadcast function for a specific object Useful for batching frequent updates (e.g., text editing)

      Parameters

      • objectId: string

        Object ID for debouncing

      • delay: number = 500

        Debounce delay in milliseconds

      Returns (data: unknown) => void