【杂记】NodeJS 中 EventEmitter 的 removeAllListeners 方法的注意事项

该文章根据 CC-BY-4.0 协议发表,转载请遵循该协议。
本文地址:https://fenying.net/post/2023/08/13/misclog-do-not-remove-all-events-in-tls-socket/

在 NodeJS 中,基于 EventEmitter 类的原生模块工具类,调用其方法 removeAllListeners 时,请务必携带参数,至少应指定具体的事件名称,以免删除掉了 NodeJS 自带的事件处理器。比如 TLS.Server……😥

comments powered by Disqus