emitter.listeners(eventName)
eventName
<string> | <symbol>- 返回: <Function[]>
返回名为 eventName
的事件的监听器数组的副本。
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// 打印: [ [Function] ]
eventName
<string> | <symbol>- Returns: <Function[]>
Returns a copy of the array of listeners for the event named eventName
.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]