CustomEvents
The app's custom events, by name, for the on: and oncapture: prefixes: declaration-merge it so on:toast={...} receives a typed event.
The app's custom events, by name, for the on: and oncapture: prefixes: declaration-merge it so
on:toast={...} receives a typed event. Empty by default; a name without an entry is not accepted
after on:.
Import#
ts
import type { CustomEvents } from "@shadow-js/web";
Signature#
ts
interface CustomEvents {}
Examples#
ts
import type { JSX } from "@shadow-js/web/jsx-runtime";
declare module "@shadow-js/web/jsx-runtime" {
interface CustomEvents {
toast: CustomEvent<{ message: string }>;
}
}
const banner: JSX.Element = <div on:toast={(event) => console.log(event.detail.message)} />;