MCPcopy Create free account
hub / github.com/EasyWebApp/WebCell / on

Function on

source/WebCell.tsx:183–199  ·  view source on GitHub ↗
(
    type: DelegatedEvent['type'],
    selector: string
)

Source from the content-addressed store, hash-verified

181 * Method decorator of DOM Event delegation
182 */
183export function on<T extends HTMLElement>(
184 type: DelegatedEvent['type'],
185 selector: string
186) {
187 return (
188 method: DelegateEventHandler,
189 { addInitializer }: ClassMethodDecoratorContext<T>
190 ) =>
191 addInitializer(function () {
192 const events = eventMap.get(this) || [],
193 handler = delegate(selector, method.bind(this));
194
195 events.push({ type, selector, handler });
196
197 eventMap.set(this, events);
198 });
199}

Callers 2

XFirthClass · 0.90
ClassClockClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected