Skip to main content
Module

x/evtemitter/mod.ts>EventEmitter#once

Eventemitter for deno.
Go to Latest
method EventEmitter.prototype.once
import { EventEmitter } from "https://deno.land/x/evtemitter@2.0.0/mod.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