MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / onClick

Function onClick

demo/chat/stream-actions.ts:99–110  ·  view source on GitHub ↗
(event: MouseEvent)

Source from the content-addressed store, hash-verified

97 }
98
99 const onClick = (event: MouseEvent) => {
100 const target = event.target;
101 if (!(target instanceof Element)) {
102 return;
103 }
104 const actionEl = target.closest<HTMLElement>("[data-stream-action]");
105 if (!actionEl || !root.contains(actionEl)) {
106 return;
107 }
108 event.preventDefault();
109 void runAction(actionEl.dataset.streamAction ?? "", actionEl);
110 };
111
112 root.addEventListener("click", onClick);
113 return () => root.removeEventListener("click", onClick);

Callers

nothing calls this directly

Calls 1

runActionFunction · 0.85

Tested by

no test coverage detected