import { default } from "https://deno.land/x/evtemitter@v3.1.0/EventEmitter.ts";
Strictly typed version of an EventEmitter
. A TypedEventEmitter
takes type
parameters for mappings of event names to event data types, and strictly
types method calls to the EventEmitter
according to these event maps.
Type Parameters
Properties
Methods
Emits a reserved event.
This method is protected
, so that only a class extending
StrictEventEmitter
can emit its own reserved events.
Emits an event.
This method is protected
, so that only a class extending
StrictEventEmitter
can get around the strict typing. This is useful for
calling emit.apply
, which can be called as emitUntyped.apply
.
Creates a wrapper function around a given callback which passes the value of the detail
property of a CustomEvent to the callback
add a callback to an event or multiple events
Emit an event with given detail Calls all listeners that listen to the emitted event
Get all EventListeners
Get all EventListeners for a specific Event
remove all EventListeners
remove all EventListeners for a specific event
remove all EventListeners for multiple specific events
remove a specific EventListener for a specific event
remove a specific EventListener for multiple specific events
add a callback to an event
add a callback to multiple events
add a callback to an event only once. After that, the listener is removed.
add a callback to multiple events only once. After that, the listener is removed.
wait for an event to be dispatched
wait for an event to be dispatched and reject after a specific amount of milliseconds
Subscribe method. Returns a cleanup function to remove the added EventListener
Static Methods
create a typed CustomEvent, which will have a typed type
property
create a typed CustomEvent, which will have types for the detail
and the type
property