emitter.prependListener(eventName, listener)


listener 函数添加到名为 eventName 的事件的监听器数组的开头。 不检查是否已添加 listener。 多次调用传入相同的 eventNamelistener 组合将导致多次添加和调用 listener

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

返回对 EventEmitter 的引用,以便可以链式调用。

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.