Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:zlib/Gunzip/removeListenerMremoveListenermethod
zlib.Gunzip.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 DuplexEventMap>(eventName: E,listener: (...args: DuplexEventMap[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-02-28 14:35:08
综合导航
成功
标题:Accessories for Fibre Optic Transceivers - FS Europe
简介:Fibre optic transceiver accessories (packaging clamshell box
-
2026-03-01 11:35:41
综合导航
成功
标题:AA06A.1TRC Absolute Reference Pressure Sensor
简介:The AA06A.1TRC Baratron® absolute pressure sensor has a pres
-
2026-02-28 00:43:29
综合导航
成功
标题:OnePlus Nord price and launch date CONFIRMED T3
简介:The OnePlus Nord will be the company
-
2026-03-01 11:44:32
图片素材
成功
标题:清晨的作文300字 描写清晨的作文 关于清晨的作文-作文网
简介:作文网精选关于清晨的300字作文,包含清晨的作文素材,关于清晨的作文题目,以清晨为话题的300字作文大全,作文网原创名师
-
2026-02-28 12:23:43
综合导航
成功
标题:Semiconductor & System Solutions Infineon Technologies
简介:Infineon Semiconductor & System Solutions - MCUs, sensors, a
-
2026-03-01 19:16:46
图片素材
成功
标题:河粉的作文700字 描写河粉的作文 关于河粉的作文-作文网
简介:作文网精选关于河粉的700字作文,包含河粉的作文素材,关于河粉的作文题目,以河粉为话题的700字作文大全,作文网原创名师
-
2026-03-01 00:12:57
教育培训
成功
标题:礼物的作文(集合4篇)
简介:在平凡的学习、工作、生活中,大家都尝试过写作文吧,作文根据体裁的不同可以分为记叙文、说明文、应用文、议论文。那么你有了解
-
2026-03-01 19:09:15
教育培训
成功
标题:(热门)可爱的家乡作文300字4篇
简介:在平日的学习、工作和生活里,大家一定都接触过作文吧,借助作文可以提高我们的语言组织能力。那么,怎么去写作文呢?下面是小编
-
2026-02-28 01:37:19
综合导航
成功
标题:Samsung's best budget phones for 2023 deliver serious bang for your buck T3
简介:The Samsung A34 and Samsung A54 promise excellent specs with
-
2026-03-01 03:59:21
教育培训
成功
标题:声音的作文400字常用(3篇)
简介:在学习、工作或生活中,大家一定都接触过作文吧,写作文可以锻炼我们的独处习惯,让自己的心静下来,思考自己未来的方向。你知道
-
2026-03-01 03:40:18
教育培训
成功
标题:环境的作文600字经典(3篇)
简介:在生活、工作和学习中,说到作文,大家肯定都不陌生吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己能明白的
-
2026-02-28 07:53:21
法律咨询
成功
标题:法律追梦人宁的个人资料 - 学法网 - 学法网 xuefa.com 与法律人共成长!
简介:法律追梦人宁的个人资料 ,学法网
-
2026-03-01 11:53:40
教育培训
成功
标题:写景校园的作文优秀(6篇)
简介:在平日的学习、工作和生活里,说到作文,大家肯定都不陌生吧,作文一定要做到主题集中,围绕同一主题作深入阐述,切忌东拉西扯,
-
2026-03-01 19:54:16
综合导航
成功
标题:For Software Vendors - From Legacy to Leader BW2
简介:Transform your legacy software business with BW2. De-risk in
-
2026-03-01 12:15:02
教育培训
成功
标题:二年级优秀作文300字通用【9篇】
简介:在生活、工作和学习中,大家都不可避免地要接触到作文吧,根据写作命题的特点,作文可以分为命题作文和非命题作文。那要怎么写好
-
2026-02-28 09:24:48
综合导航
成功
标题:Jay Chou’s former friend Cai Weize, who was called out by him, ran away with Bitcoin worth hundreds of millions of Taiwa Bee Network
简介:By Golem ( @web3_golem ) On October 15, Jay Chou, who had ju
-
2026-02-28 13:50:28
综合导航
成功
标题:The Magic of Analogue Photography is still alive
简介:1x.com is the world
-
2026-03-01 11:39:13
图片素材
成功
标题:班的小的作文900字 描写班的小的作文 关于班的小的作文-作文网
简介:作文网精选关于班的小的900字作文,包含班的小的作文素材,关于班的小的作文题目,以班的小为话题的900字作文大全,作文网
-
2026-03-01 00:15:29
综合导航
成功
标题:FIPP - Media News, Training, And Events
简介:FIPP provides media news, trainnig and events, with members
-
2026-03-01 00:20:50
图片素材
成功
标题:念念不忘的作文800字 描写念念不忘的作文 关于念念不忘的作文-作文网
简介:作文网精选关于念念不忘的800字作文,包含念念不忘的作文素材,关于念念不忘的作文题目,以念念不忘为话题的800字作文大全
-
2026-03-01 19:28:31
综合导航
成功
标题:Cartes Accès TD - Technologie à Puce Groupe Financier Banque TD
简介:Soyez au courant des mesures sécuritaires employées sur toue
-
2026-02-28 08:50:07
综合导航
成功
标题:Clarke goes bar down NHL.com
简介:Brandt Clarke takes advantage of a screen in front and blast
-
2026-03-01 19:25:23
教育培训
成功
标题:关爱的作文600字4篇【荐】
简介:在日常学习、工作和生活中,大家都经常接触到作文吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题意义的记叙方法
-
2026-02-28 01:13:15
综合导航
成功
标题:Kids Room Hidden Stars - Free Online Mobile Game on 4J.com
简介:Kids Room Hidden Stars is a free online Mobile game on 4j.Co
-
2026-03-01 19:02:30
教育培训
成功
标题:买年货小学作文锦集九篇
简介:在日常的学习、工作、生活中,大家都不可避免地会接触到作文吧,作文可分为小学作文、中学作文、大学作文(论文)。相信许多人会
-
2026-02-27 19:46:37
综合导航
成功
标题:æå²çæ¼é³_æå²çææ_æå²çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½æå²é¢é,ä»ç»æå²,æå²çæ¼é³,æå²æ¯
-
2026-03-01 00:18:42
教育培训
成功
标题:精选我也想作文500字三篇
简介:在日常学习、工作和生活中,大家都写过作文吧,借助作文人们可以反映客观事物、表达思想感情、传递知识信息。那么,怎么去写作文
-
2026-02-28 12:31:19
新闻资讯
成功
标题:你的数据安全吗? 点击“同意”,你的隐私已经泄漏..., 站长资讯平台
简介:大数据为人们描绘出一幅信息通畅、高效便捷的美好景象,但背后的交易市场仍处于初期粗放阶段。在大数据上升为国家战略的背景下,
-
2026-02-28 12:48:30
综合导航
成功
标题:Pants holgados y wide leg pants para mujer American Eagle
简介:Compra Pants Wide Leg y holgados para mujer en American Eagl
-
2026-02-28 14:39:54
综合导航
成功
标题:Pixel Cat Simulator My Pets 🐱 Casual Free Game
简介:Enter a pixelated world. Begin a fun simulator of virtual ra