Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:http/ServerResponse/removeListenerMremoveListenermethod
http.ServerResponse.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 OutgoingMessageEventMap>(eventName: E,listener: (...args: OutgoingMessageEventMap[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 14:19:45
图片素材
成功
标题:索亚的作文650字 描写索亚的作文 关于索亚的作文-作文网
简介:作文网精选关于索亚的650字作文,包含索亚的作文素材,关于索亚的作文题目,以索亚为话题的650字作文大全,作文网原创名师
-
2026-03-02 22:16:42
视频影音
成功
标题:《Láska a dřeváky》1914电影在线观看完整版剧情 - xb1
简介:Láska a dřeváky(1914)电影免费在线观看完整版剧情介绍,Láska a dřeváky主要演员阵容、上
-
2026-03-02 12:21:31
综合导航
成功
标题:小学四年级作文(范例5篇)
简介:在平平淡淡的日常中,说到作文,大家肯定都不陌生吧,借助作文可以宣泄心中的情感,调节自己的心情。一篇什么样的作文才能称之为
-
2026-03-02 18:00:09
图片素材
成功
标题:地方文化的作文300字 描写地方文化的作文 关于地方文化的作文-作文网
简介:作文网精选关于地方文化的300字作文,包含地方文化的作文素材,关于地方文化的作文题目,以地方文化为话题的300字作文大全
-
2026-03-02 17:54:14
综合导航
成功
标题:Browne v Associated Newspapers Ltd - 5RB Barristers
简介:Browne v Associated Newspapers Ltd -
-
2026-03-02 17:56:41
综合导航
成功
标题:Galaxy Research Report Summary: Who is the protagonist in the crypto lending market? Bee Network
简介:Original article by: Zack Pokorny, Galaxy Research Analyst
-
2026-03-02 17:44:07
综合导航
成功
标题:ééçæ¼é³_ééçææ_ééçç¹ä½_è¯ç»ç½
简介:è¯ç»ç½ééé¢é,ä»ç»éé,ééçæ¼é³,é鿝
-
2026-03-02 22:09:41
视频影音
成功
标题:对不起我不是你的白月光第03集红豆剧场_在线播放[高清流畅]_爽文短剧
简介:爽文短剧_对不起我不是你的白月光剧情介绍:对不起我不是你的白月光是由内详执导,内详等人主演的,于2025年上映,该剧情讲
-
2026-03-02 06:36:38
旅游出行
成功
标题:荷兰作文300字(通用29篇)
简介:在平平淡淡的学习、工作、生活中,大家都写过作文吧,作文根据写作时限的不同可以分为限时作文和非限时作文。那要怎么写好作文呢
-
2026-03-02 11:57:40
数码科技
成功
标题:学企业网站开发江苏省建设协会网站-北京孤凡电子商务有限公司
简介:学企业网站开发,江苏省建设协会网站,企业seo顾问公司,wordpress商业授权1.线性表的定义 线性表是具有相同数据
-
2026-03-02 10:53:12
视频影音
成功
标题:a卡和n卡的区别 a卡和n卡如何选择介绍-驱动人生
简介:a卡和n卡是指使用AMD和NVIDIA公司的图形处理器(GPU)的显卡,是目前市场上最流行的两种显卡品牌,广泛应用于游戏
-
2026-03-02 09:46:10
综合导航
成功
标题:American Football Challenge - Play The Free Game Online
简介:American Football Challenge - click to play online. American
-
2026-03-02 22:02:22
综合导航
成功
标题:Odaily interviews Arthur Hayes: There is no counterfeit season, I bought a lot of gold barsRecommended Articles Bee Network
简介:Author: Hao Fangzhou Meet Arthur Hayes in person! The cr
-
2026-03-02 10:41:48
教育培训
成功
标题:有朋友真好作文范文
简介:在日常学习、工作或生活中,许多人都写过作文吧,作文是由文字组成,经过人的思想考虑,通过语言组织来表达一个主题意义的文体。
-
2026-03-02 21:53:51
综合导航
成功
标题:æ¯é¥°çæ¼é³_æ¯é¥°çææ_æ¯é¥°çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½æ¯é¥°é¢é,ä»ç»æ¯é¥°,æ¯é¥°çæ¼é³,æ¯é¥°æ¯
-
2026-03-02 10:40:17
综合导航
成功
标题:Christmas Ornaments Memory - Play The Free Mobile Game Online
简介:Christmas Ornaments Memory - click to play online. Christmas
-
2026-03-02 14:21:19
图片素材
成功
标题:感叹的作文1500字 描写感叹的作文 关于感叹的作文-作文网
简介:作文网精选关于感叹的1500字作文,包含感叹的作文素材,关于感叹的作文题目,以感叹为话题的1500字作文大全,作文网原创
-
2026-03-02 06:28:58
教育培训
成功
标题:语文老师作文集锦【4篇】
简介:在日复一日的学习、工作或生活中,大家都跟作文打过交道吧,写作文可以锻炼我们的独处习惯,让自己的心静下来,思考自己未来的方
-
2026-03-02 18:12:07
教育培训
成功
标题:6.5INCH串口模组规格书20150609 - 豆丁网
简介:豆丁网是面向全球的中文社会化阅读分享平台,拥有商业,教育,研究报告,行业资料,学术论文,认证考试,星座,心理学等数亿实用
-
2026-03-02 10:56:58
综合导航
成功
标题:Fixed Radiometer - HTS Commercial & Industrial HVAC Systems, Parts, & Services Company
简介:3
-
2026-03-02 22:01:54
电商商城
成功
标题:小型相机架新款 - 小型相机架2021年新款 - 京东
简介:京东是国内专业的小型相机架网上购物商城,本频道提供小型相机架新款价格、小型相机架新款图片信息,为您选购小型相机架提供全方
-
2026-03-02 17:57:12
教育培训
成功
标题:三年级语文作文精品[10篇]
简介:在日常学习、工作抑或是生活中,大家总少不了接触作文吧,借助作文可以宣泄心中的情感,调节自己的心情。相信许多人会觉得作文很
-
2026-03-02 18:11:42
电商商城
成功
标题:酷艾芙连衣裙 - 京东
简介:京东是国内专业的酷艾芙连衣裙网上购物商城,本频道提供酷艾芙连衣裙商品图片,酷艾芙连衣裙价格,酷艾芙连衣裙多少钱信息,为您
-
2026-03-02 17:44:04
综合导航
成功
标题:顾è§çæ¼é³_顾è§çææ_顾è§çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½é¡¾è§é¢é,ä»ç»é¡¾è§,顾è§çæ¼é³,é¡¾è§æ¯
-
2026-03-02 11:58:02
综合导航
成功
标题:长歌英雄曲目录最新章节_长歌英雄曲全文免费阅读_风云中文网
简介:长歌英雄曲目录最新章节由网友提供,《长歌英雄曲》情节跌宕起伏、扣人心弦,是一本情节与文笔俱佳的风云中文网,风云中文网免费
-
2026-03-02 12:15:21
综合导航
成功
标题:Vie d’Église
简介:Excelsis, librairie chrétienne, protestante et évangélique e
-
2026-03-02 17:51:49
综合导航
成功
标题:我的祖先是蚩尤最新章节_第42章 番外 杀人校园 3第1页_我的祖先是蚩尤免费阅读_恋上你看书网
简介:第42章 番外 杀人校园 3第1页_我的祖先是蚩尤_爱雷云_恋上你看书网
-
2026-03-02 06:35:15
图片素材
成功
标题:初二写人作文700字 初二700字写人作文大全-作文网
简介:作文网优秀初二写人700字作文大全,包含初二写人700字作文素材,初二写人700字作文题目、美文范文,作文网原创名师点评
-
2026-03-02 22:12:12
综合导航
成功
标题:第三十六章 八折优惠_西门仙族_道心长青_新笔趣阁(56xu.com)
简介:西门仙族无防盗章节,作者道心长青,第三十六章 八折优惠内容简要:西门仁善是西门家唯一的一阶中品炼丹师,钻研炼丹术超过五十
-
2026-03-02 09:49:19
综合导航
成功
标题:Weekly Editor’s Picks (1018-1024) Bee Network
简介:Therefore, every Saturday, our editorial department will sel