method
http2.Http2Server.prependOnceListener
prependOnceListener<E extends keyof Http2ServerEventMap<typeof IncomingMessage, typeof ServerResponse, typeof Http2ServerRequest, typeof Http2ServerResponse>>(
eventName: E,
listener: (...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]) => void
): this;
Adds a one-time listener 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.
@param eventName
The name of the event.
@param listener
The callback function
eventName: string | symbol,
listener: (...args: any[]) => void
): this;
Adds a one-time listener 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.
@param eventName
The name of the event.
@param listener
The callback function