prependOnceListener
fun <T : EventEmitter, P : JsTuple> T.prependOnceListener(type: EventType<T, P>, listener: (P) -> Unit)(source)
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!');
});
Content copied to clipboard
Returns a reference to the EventEmitter
, so that calls can be chained.
Since
v6.0.0
Parameters
type
The name of the event.
listener
The callback function