Event Bus WebComponent

DOM CustomEvent bus with source/target envelopes and ALL broadcasts.

Send events

Sender
import { WebComponentEventBus, ALL, ALL_TYPES } from '@manufosela/event-bus-webcomponent'; const bus = new WebComponentEventBus(); bus.on({ id: 'card-b', type: 'demo-card' }, (envelope) => { console.log(envelope.name, envelope.detail); }); bus.emit({ name: 'ping', detail: { ok: true }, source: { id: 'card-a', type: 'demo-card' }, target: { id: ALL, type: ALL_TYPES, excludeSource: true } });

Component A (card-a)

Component B (card-b)

Component C (card-c)

Component D (card-d)