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

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -