LoginSignup
2

More than 5 years have passed since last update.

EventEmitterでイベントリスナーを削除する

Posted at

追加は on だが削除は removeListener を使う。

var callback = (stream) => {
  console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);

関連

EventEmitter2では off が使えるらしい。
http://yosuke-furukawa.hatenablog.com/entry/2013/12/28/145647

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2