Skip to content

Documentation / @ripl/vue / useForwardedEvents

Function: useForwardedEvents() ​

useForwardedEvents<TEventMap>(source, emit): void

Defined in: adapters/vue/src/core/events.ts:70

Forwards an event bus's events to Vue listeners, subscribing only to those a listener is actually bound to.

The eligible names come from the bus itself (EventBus.$events), so the adapter cannot drift from the events a Ripl object actually emits.

The filtering is not an optimisation. Element.on invalidates the context's tracked-element cache for pointer events, so subscribing to everything up front would silently make every element a hit-test target and change which element receives a click.

Type Parameters ​

Type Parameter
TEventMap extends EventMap

Parameters ​

ParameterTypeDescription
source() => EventBus<TEventMap> | undefinedThe bus to forward from, e.g. an element, context or renderer.
emit(event, ...args) => voidThe component's emit function.

Returns ​

void