Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/velo/deps.ts>EventEmitter#prependListener

Performant Cache implementations for Deno. Supports LRU, LFU, ARC and other caching policies.
Go to Latest
method EventEmitter.prototype.prependListener
Re-export
import { EventEmitter } from "https://deno.land/x/velo@0.1.5/deps.ts";

Adds the listener function to the beginning 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 eventNameand listener will result in the listener being added, and called, multiple times.

server.prependListener('connection', (stream) => {
  console.log('someone connected!');
});

Returns a reference to the EventEmitter, so that calls can be chained.

Parameters

eventName: string | symbol

The name of the event.

listener: (...args: any[]) => void

The callback function