Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
method EventEmitter.prototype.once
import { EventEmitter } from "https://deno.land/x/evtemitter@2.0.0/EventEmitter.ts";

add a callback to an event only once. After that, the listener is removed.

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 only once. After that, the listener is removed.

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