MCPcopy
hub / github.com/TanStack/router / callHandler

Function callHandler

packages/solid-router/src/link.tsx:397–410  ·  view source on GitHub ↗

Call a JSX.EventHandlerUnion with the event.

(
    event: TEvent & { currentTarget: T; target: Element },
    handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,
  )

Source from the content-addressed store, hash-verified

395
396 /** Call a JSX.EventHandlerUnion with the event. */
397 function callHandler<T, TEvent extends Event>(
398 event: TEvent & { currentTarget: T; target: Element },
399 handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,
400 ) {
401 if (handler) {
402 if (typeof handler === 'function') {
403 handler(event)
404 } else {
405 handler[0](handler[1], event)
406 }
407 }
408
409 return event.defaultPrevented
410 }
411
412 function composeEventHandlers<T>(
413 handlers: Array<Solid.JSX.EventHandlerUnion<T, any> | undefined>,

Callers 1

composeEventHandlersFunction · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected