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

Subscribe method. Returns a cleanup function to remove the added EventListener

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

Returns

Fn<never, void>

cleanup function