import { TypedEventTarget } from "https://deno.land/x/enzastdlib@v0.0.4/events/mod.ts";
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
Examples
Example 1
Example 1
import { TypedEventTarget } from 'https://deno.land/x/enzastdlib/events/mod.ts';
const event_target = new TypedEventTarget<
{ myEvent: CustomEvent<{ myValue: number }> }
>();
const event = new CustomEvent('myEvent', { detail: { myValue: 1 } });
event_target.addEventListener('myEvent', console.log);
event_target.dispatchEvent(event); // `{ myValue: 1 }`
Parameters
event: Event