Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:http/ClientRequest/removeListenerMremoveListenermethod
http.ClientRequest.removeListener { console.log('someone connected!'); }; server.on('connection', callback); // ... server.removeListener('connection', callback); ``` `removeListener()` will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified `eventName`, then `removeListener()` must be called multiple times to remove each instance. Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution will not remove them from `emit()` in progress. Subsequent events behave as expected. ```js import { EventEmitter } from 'node:events'; class MyEmitter extends EventEmitter {} const myEmitter = new MyEmitter(); const callbackA = () => { console.log('A'); myEmitter.removeListener('event', callbackB); }; const callbackB = () => { console.log('B'); }; myEmitter.on('event', callbackA); myEmitter.on('event', callbackB); // callbackA removes listener callbackB but it will still be called. // Internal listener array at time of emit [callbackA, callbackB] myEmitter.emit('event'); // Prints: // A // B // callbackB is now removed. // Internal listener array [callbackA] myEmitter.emit('event'); // Prints: // A ``` Because listeners are managed using an internal array, calling this will change the position indexes of any listener registered _after_ the listener being removed. This will not impact the order in which listeners are called, but it means that any copies of the listener array as returned by the `emitter.listeners()` method will need to be recreated. When a single function has been added as a handler multiple times for a single event (as in the example below), `removeListener()` will remove the most recently added instance. In the example the `once('ping')` listener is removed: ```js import { EventEmitter } from 'node:events'; const ee = new EventEmitter(); function pong() { console.log('pong'); } ee.on('ping', pong); ee.once('ping', pong); ee.removeListener('ping', pong); ee.emit('ping'); ee.emit('ping'); ``` Returns a reference to the `EventEmitter`, so that calls can be chained." data-algolia-static="false" data-algolia-merged="false" data-type="Method">removeListenerE extends keyof ClientRequestEventMap>(eventName: E,listener: (...args: ClientRequestEventMap[E]) => void): this;Removes the specified listener from the listener array for the event named eventName.const callback = (stream) => { console.log('someone connected!'); }; server.on('connection', callback); // ... server.removeListener('connection', callback); removeListener() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener() must be called multiple times to remove each instance.Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them from emit() in progress. Subsequent events behave as expected.import { EventEmitter } from 'node:events'; class MyEmitter extends EventEmitter {} const myEmitter = new MyEmitter(); const callbackA = () => { console.log('A'); myEmitter.removeListener('event', callbackB); }; const callbackB = () => { console.log('B'); }; myEmitter.on('event', callbackA); myEmitter.on('event', callbackB); // callbackA removes listener callbackB but it will still be called. // Internal listener array at time of emit [callbackA, callbackB] myEmitter.emit('event'); // Prints: // A // B // callbackB is now removed. // Internal listener array [callbackA] myEmitter.emit('event'); // Prints: // A Because listeners are managed using an internal array, calling this will change the position indexes of any listener registered after the listener being removed. This will not impact the order in which listeners are called, but it means that any copies of the listener array as returned by the emitter.listeners() method will need to be recreated.When a single function has been added as a handler multiple times for a single event (as in the example below), removeListener() will remove the most recently added instance. In the example the once('ping') listener is removed:import { EventEmitter } from 'node:events'; const ee = new EventEmitter(); function pong() { console.log('pong'); } ee.on('ping', pong); ee.once('ping', pong); ee.removeListener('ping', pong); ee.emit('ping'); ee.emit('ping'); Returns a reference to the EventEmitter, so that calls can be chained.removeListener(eventName: string | symbol,listener: (...args: any[]) => void): this;Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San FranciscoWe're hiring →智能索引记录
-
2026-03-02 18:01:02
综合导航
成功
标题:魅魔姐妹 巴比伦最新章节_魅魔姐妹 巴比伦小说免费全文阅读_恋上你看书网
简介:诺克罗监狱,萨格帝国最可怕的监狱,也是最另类,最黑暗的监狱。诺克罗监狱建在地下,通往外界的路只有一条,且只有一个月才会开
-
2026-03-02 13:59:17
综合导航
成功
标题:tgc官网(thatshop sky官方旗舰店)_火必 Huobi交易所
简介:今天给各位分享tgc官网的知识,其中也会对thatshop sky官方旗舰店进行解释,如果能碰巧解决你现在面临的问题,别
-
2026-03-02 14:14:31
图片素材
成功
标题:良师益友的作文 描写良师益友的作文 关于良师益友的作文 素材-作文网
简介:作文网精选关于良师益友的作文,包含良师益友的作文素材,关于良师益友的作文题目,以良师益友为话题的作文大全,作文网原创名师
-
2026-03-02 10:49:10
游戏娱乐
成功
标题:天尊传奇官服,天尊传奇礼包,开服表,新服,九职业
简介:03游戏天尊传奇,天尊传奇传奇,零三游戏,正版传奇,官方正版授权,绿色服,网页游戏新服礼包,游戏攻略,开服表,网页游戏平
-
2026-03-02 14:12:51
综合导航
成功
标题:十二小说网_玄幻小说_言情小说_都市小说_好看的免费小说网_规则类怪谈扮演指南
简介:十二小说网是网络小说书迷喜爱的免费小说网,收录最热门的好看小说,小说更新速度更快,主打玄幻、都市、官场、乡村、仙侠、军事
-
2026-03-02 18:54:32
综合导航
成功
标题:TheDomains.com - Award winning domain name Industry publication on domain news, gTLD's, registrars and registries.
简介:Award winning domain name Industry publication on domain new
-
2026-03-02 10:31:35
综合导航
成功
标题:ä¸å§çæ¼é³_ä¸å§çææ_ä¸å§çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½ä¸å§é¢é,ä»ç»ä¸å§,ä¸å§çæ¼é³,ä¸å§æ¯
-
2026-03-02 13:09:02
教育培训
成功
标题:实用的烟花四年级作文300字汇编五篇
简介:在日常的学习、工作、生活中,大家都不可避免地会接触到作文吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己
-
2026-03-02 13:13:58
教育培训
成功
标题:初三作文集合七篇
简介:在日复一日的学习、工作或生活中,大家都跟作文打过交道吧,通过作文可以把我们那些零零散散的思想,聚集在一块。相信许多人会觉
-
2026-03-02 18:54:57
新闻资讯
成功
标题:美国深夜收到消息:发两条公告,亚洲震动,日本右翼陷入癫狂 岸田文雄 中国 国际社会 国际资讯_网易视频
简介:美国深夜收到消息:发两条公告,亚洲震动,日本右翼陷入癫狂
-
2026-03-02 18:55:45
综合导航
成功
标题:Node diagnostics_channel.Channel class API Reference Bun
简介:The class `Channel` represents an individual named channel w
-
2026-03-02 17:57:53
游戏娱乐
成功
标题:郊区冷饮店,郊区冷饮店小游戏,4399小游戏 www.4399.com
简介:郊区冷饮店在线玩,郊区冷饮店下载, 郊区冷饮店攻略秘籍.更多郊区冷饮店游戏尽在4399小游戏,好玩记得告诉你的朋友哦!
-
2026-03-02 17:15:28
综合导航
成功
标题:Cross-division. World English Historical Dictionary
简介:Cross-division. World English Historical Dictionary
-
2026-03-02 14:04:03
教育培训
成功
标题:有你真好作文
简介:在日常学习、工作抑或是生活中,大家都跟作文打过交道吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己能明白
-
2026-03-02 17:14:35
游戏娱乐
成功
标题:芭比公主音乐会,芭比公主音乐会小游戏,4399小游戏 www.4399.com
简介:芭比公主音乐会在线玩,芭比公主音乐会下载, 芭比公主音乐会攻略秘籍.更多芭比公主音乐会游戏尽在4399小游戏,好玩记得告
-
2026-03-02 10:37:50
教育培训
成功
标题:亲情作文[精品15篇]
简介:在日常学习、工作和生活中,大家都跟作文打过交道吧,写作文可以锻炼我们的独处习惯,让自己的心静下来,思考自己未来的方向。写
-
2026-03-02 12:59:57
综合导航
成功
标题:DVD Forgiven – Un film de Roland Joffé – Excelsis
简介:3700000265078, dvd, forgiven, roland joffé
-
2026-03-02 09:49:24
综合导航
成功
标题:他……_750字_作文网
简介:享受 这个词的体现在很多方面!但是在我看来,享受失败的人却只有一个,那就是只有一面之缘的 他 那是2014年的
-
2026-03-02 10:21:16
教育培训
成功
标题:神不守舍的意思解释_神不守舍是什么意思-雄安文学网
简介:神不守舍是什么意思?雄安文学网为您提供神不守舍的意思解释、拼音、近反义词,以及神不守舍成语接龙,供成语爱好者参考学习用。
-
2026-03-02 13:26:56
教育培训
成功
标题:雨中即景作文
简介:无论在学习、工作或是生活中,大家都经常看到作文的身影吧,作文是通过文字来表达一个主题意义的记叙方法。一篇什么样的作文才能
-
2026-03-02 10:09:48
综合导航
成功
标题:Presenting Luxury Living in Amsterdam LG Global
简介:LG SIGNATURE recently showcased its elegant home appliances
-
2026-03-02 18:02:40
综合导航
成功
标题:Why do DeFi users reject fixed interest rates? Bee Network
简介:Compiled by Odaily Planet Daily Golem ( @web3_golem ) The
-
2026-03-02 09:46:26
实用工具
成功
标题:【实用】中秋节的作文100字集锦5篇
简介:无论是在学校还是在社会中,大家总免不了要接触或使用作文吧,作文是通过文字来表达一个主题意义的记叙方法。你所见过的作文是什
-
2026-03-02 13:09:13
综合导航
成功
标题:In-depth analysis: PerpDEX is in a reshuffle, what else can Hyperliquid do? Bee Network
简介:Global Sustainable DEX Market Overview and Industry Changes
-
2026-03-02 10:53:07
综合导航
成功
标题:深度蜜爱:腹黑老公,悠着点!最新章节_77 第77章 禽兽不起来第1页_深度蜜爱:腹黑老公,悠着点!免费阅读_恋上你看书网
简介:77 第77章 禽兽不起来第1页_深度蜜爱:腹黑老公,悠着点!_雪如歌_恋上你看书网
-
2026-03-02 18:55:13
综合导航
成功
标题:çç»è¯_çåç»è¯_è¯ç»ç½
简介:è¯ç»ç½çç»è¯é¢é,æä¾å ³äºçç»è¯ç¸å ³è¯è¯,ç
-
2026-03-02 13:07:23
教育培训
成功
标题:【热门】动作作文300字4篇
简介:在日常学习、工作或生活中,大家总少不了接触作文吧,作文一定要做到主题集中,围绕同一主题作深入阐述,切忌东拉西扯,主题涣散
-
2026-03-02 09:50:16
数码科技
成功
标题:美漫丧钟第813章 博物馆奇妙夜_美漫丧钟_混沌文工团_十二小说网_规则类怪谈扮演指南
简介:美漫丧钟最新章节第813章 博物馆奇妙夜出自混沌文工团的作品美漫丧钟最新章节每天第一时间更新。美漫丧钟txt电子书下载,
-
2026-03-02 10:11:00
综合导航
成功
标题:The Ultimate Guide to Construction Financial Management hh2.com Time and Attendance
简介:Time and Attendance Explore expert advice, in-depth articl
-
2026-03-02 14:25:42
综合导航
成功
标题:人族鎮守使-第3583章 混沌動亂最新章節-台灣小說網
简介:台灣小說網整理人族鎮守使全集無彈窗在線閱讀,當前章節:第3583章 混沌動亂