Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/node/events.ts>default#on

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method default.prototype.on
import { default } from "https://deno.land/std@0.36.0/node/events.ts";

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

Parameters

eventName: string | symbol
listener: Function | WrappedFunction