i-event-bus

The Hass Blocks internal event bus

Name i-event-bus
Type Interface
Path packages/blocks/src/types/i-event-bus.ts

Methods

emit

Emit an event on the bus

Signature
    emit<ET extends HassBlocksEvent['eventType'], T extends HassBlocksEvent & {
        eventType: ET;
    }>(type: ET, event?: Omit<T, 'id' | 'timestamp' | 'eventType'>): void; 
Parameters
Name Type Description
type ET
event Omit<T, 'id' | 'timestamp' | 'eventType'> the event to be emitted
Return Value
void

subscribe

Subscribe to the event bus

Signature
    subscribe(callback: (event: HassBlocksEvent) => void): void; 
Parameters
Name Type Description
callback (event: HassBlocksEvent) => void callback that is executed when an event is received
Return Value
void