Subscribe to block lifecycle events in the design engine.
The EventAPI enables real-time monitoring of block changes through event subscriptions. Events are bundled and delivered efficiently at the end of each engine update cycle.
Event Subscriptions#
Subscribe to block lifecycle events with filtering and callback management.
subscribe()#
Subscribe to block lifecycle events.
Events are bundled and delivered at the end of each engine update cycle for efficient processing.
Parameters#
Parameter | Type | Description |
---|---|---|
blocks | number [] | List of blocks to filter events by. If empty, events for all blocks are sent. |
callback | (events ) => void | Function called with bundled events. |
Returns#
A method to unsubscribe from the events.
(): void;
Returns#
void
Signature#
subscribe(blocks: number[], callback: (events: BlockEvent[]) => void): () => void