javascript - removeListener in the Listener in nodejs -


in addition this question. possible remove listener inside callback function?

for example:

var callback = function(stream) {   if(something)      dosomething();   else      server.removelistener('connection', callback); }; server.on('connection', callback);   

yes possible. node's eventemitter class provide once function, in order attach listener called... once.


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -