Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

newListener event #8853

Closed
Closed
@smart--petea

Description

@smart--petea

In http://nodejs.org/api/events.html is written:

Event: 'newListener'#
event String The event name
listener Function The event handler function
This event is emitted any time someone adds a new listener. It is unspecified if listener is in the list returned by emitter.listeners(event).

From this snippet I learnt that if listener is in listeners the newListener event is not fired.

I did

var EE = require('events');
var ee = new EE;

var fnOk = function(){}

ee.on('newListener', function(){
  console.log('NEW LISTENER', arguments);
})

ee.on('ok' , fnOk); //fnOk is in ee.listeners('ok')
ee.on('ok', fnOk);

event newListener is fired twice in spite of fact that listener is just in listeners array.

May be I am wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions