MprependListener
Bun

method

http.Server.prependListener

event: string,
listener: (...args: any[]) => void
): this;

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 eventName and 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.

@param listener

The callback function

event: 'close',
listener: () => void
): this;
event: 'connection',
listener: (socket: Socket) => void
): this;
event: 'error',
listener: (err: Error) => void
): this;
event: 'listening',
listener: () => void
): this;
event: 'checkContinue',
listener: RequestListener<Request, Response>
): this;
event: 'checkExpectation',
listener: RequestListener<Request, Response>
): this;
event: 'clientError',
listener: (err: Error, socket: Duplex) => void
): this;
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void
): this;
event: 'dropRequest',
listener: (req: InstanceType<Request>, socket: Duplex) => void
): this;
event: 'request',
listener: RequestListener<Request, Response>
): this;
event: 'upgrade',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void
): this;