MCPcopy Index your code
hub / github.com/CapSoftware/Cap / callHandler

Function callHandler

apps/desktop/src/utils/composeEventHandlers.ts:3–16  ·  view source on GitHub ↗
(
	event: E & { currentTarget: T; target: Element },
	handler: JSX.EventHandlerUnion<T, E> | undefined,
)

Source from the content-addressed store, hash-verified

1import type { JSX } from "solid-js";
2
3export function callHandler<T, E extends Event>(
4 event: E & { currentTarget: T; target: Element },
5 handler: JSX.EventHandlerUnion<T, E> | undefined,
6) {
7 if (handler) {
8 if (typeof handler === "function") {
9 handler(event);
10 } else {
11 handler[0](handler[1], event);
12 }
13 }
14
15 return event?.defaultPrevented;
16}
17
18export function composeEventHandlers<T, E extends Event = Event>(
19 handlers: Array<JSX.EventHandlerUnion<T, E> | undefined>,

Callers 1

composeEventHandlersFunction · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected