getPrefixedEventHandlers

Commons
stable

Filters event-handler attrs by a trailing suffix, strips the suffix, and wraps each handler so it receives an extra getData argument. Used internally to forward scoped event listeners through component boundaries.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

attrs
required
Record<string, any>
The raw attrs object from $attrs / useAttrs(). Only keys that pass isOn() and end with the given suffix are selected.
suffix
required
T
A colon-prefixed suffix string (e.g. ":input"). Event handler keys ending with this suffix are matched and stripped.
getData
required
TEventHandler
A function called with each event to produce the extra data argument forwarded to the original handler.

API

Return value

The value returned by this util.

An object keyed by the stripped event handler names, each wrapping the original handler with the extra getData call.

Usage

Examples

Ready-to-paste usage snippets.

Forward scoped event handlers

typescript