Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/ext/node/polyfills/events.ts>default#prependOnceListener

A modern runtime for JavaScript and TypeScript.
Go to Latest
method default.prototype.prependOnceListener
import { default } from "https://deno.land/x/deno@v1.39.0/ext/node/polyfills/events.ts";

Adds a one-timelistener function for the event named eventName to the_beginning_ of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

server.prependOnceListener('connection', (stream) => {
  console.log('Ah, we have our first user!');
});

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