Skip to main content
Go to Latest
method EventEmitter.prototype.on
import { EventEmitter } from "https://deno.land/x/evtemitter@2.0.0/EventEmitter.ts";

add a callback to an event

Type Parameters

K extends keyof T & string

Parameters

type: K

the event name the callback should listen to

callback: CustomEventCallbackOn<T[K]>

the callback to execute when the event is dispatched

add a callback to multiple events

Type Parameters

K extends keyof T & string

Parameters

types: K[]

an array of the event names the callback should listen to

callback: CustomEventCallbackOn<T[K]>

the callback to execute when the event is dispatched