Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:diagnostics_channel/ChannelMbindStorePhasSubscribersPnameMpublishMrunStoresMsubscribeMunbindStoreMunsubscribeclass
diagnostics_channel.Channelclass ChannelStoreType = unknown, ContextType = StoreType>The class Channel represents an individual named channel within the data pipeline. It is used to track subscribers and to publish messages when there are subscribers present. It exists as a separate object to avoid channel lookups at publish time, enabling very fast publish speeds and allowing for heavy use while incurring very minimal cost. Channels are created with channel, constructing a channel directly with new Channel(name) is not supported.readonly hasSubscribers: booleanCheck if there are active subscribers to this channel. This is helpful if the message you want to send might be expensive to prepare.This API is optional but helpful when trying to publish messages from very performance-sensitive code.import diagnostics_channel from 'node:diagnostics_channel'; const channel = diagnostics_channel.channel('my-channel'); if (channel.hasSubscribers) { // There are subscribers, prepare and publish message } readonly name: string | symbol { return { data }; }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">bindStore(store: AsyncLocalStorageStoreType>,transform?: (context: ContextType) => StoreType): void;When channel.runStores(context, ...) is called, the given context data will be applied to any store bound to the channel. If the store has already been bound the previous transform function will be replaced with the new one. The transform function may be omitted to set the given context data as the context directly.import diagnostics_channel from 'node:diagnostics_channel'; import { AsyncLocalStorage } from 'node:async_hooks'; const store = new AsyncLocalStorage(); const channel = diagnostics_channel.channel('my-channel'); channel.bindStore(store, (data) => { return { data }; }); @param storeThe store to which to bind the context data@param transformTransform context data before setting the store contextpublish(message: unknown): void;Publish a message to any subscribers to the channel. This will trigger message handlers synchronously so they will execute within the same context.import diagnostics_channel from 'node:diagnostics_channel'; const channel = diagnostics_channel.channel('my-channel'); channel.publish({ some: 'message', }); @param messageThe message to send to the channel subscribers { const parent = store.getStore(); return new Span(message, parent); }); channel.runStores({ some: 'message' }, () => { store.getStore(); // Span({ some: 'message' }) }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">runStoresThisArg = any, Args extends any[] = any[], Result = any>(context: ContextType,fn: (this: ThisArg, ...args: Args) => Result,thisArg?: ThisArg,...args: Args): Result;Applies the given data to any AsyncLocalStorage instances bound to the channel for the duration of the given function, then publishes to the channel within the scope of that data is applied to the stores.If a transform function was given to channel.bindStore(store) it will be applied to transform the message data before it becomes the context value for the store. The prior storage context is accessible from within the transform function in cases where context linking is required.The context applied to the store should be accessible in any async code which continues from execution which began during the given function, however there are some situations in which context loss may occur.import diagnostics_channel from 'node:diagnostics_channel'; import { AsyncLocalStorage } from 'node:async_hooks'; const store = new AsyncLocalStorage(); const channel = diagnostics_channel.channel('my-channel'); channel.bindStore(store, (message) => { const parent = store.getStore(); return new Span(message, parent); }); channel.runStores({ some: 'message' }, () => { store.getStore(); // Span({ some: 'message' }) }); @param contextMessage to send to subscribers and bind to stores@param fnHandler to run within the entered storage context@param thisArgThe receiver to be used for the function call.@param argsOptional arguments to pass to the function. { // Received data }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">subscribe(onMessage: ChannelListener): void;Register a message handler to subscribe to this channel. This message handler will be run synchronously whenever a message is published to the channel. Any errors thrown in the message handler will trigger an 'uncaughtException'.import diagnostics_channel from 'node:diagnostics_channel'; const channel = diagnostics_channel.channel('my-channel'); channel.subscribe((message, name) => { // Received data }); @param onMessageThe handler to receive channel messagesunbindStore(store: AsyncLocalStorageStoreType>): boolean;Remove a message handler previously registered to this channel with channel.bindStore(store).import diagnostics_channel from 'node:diagnostics_channel'; import { AsyncLocalStorage } from 'node:async_hooks'; const store = new AsyncLocalStorage(); const channel = diagnostics_channel.channel('my-channel'); channel.bindStore(store); channel.unbindStore(store); @param storeThe store to unbind from the channel.@returnstrue if the store was found, false otherwise.unsubscribe(onMessage: ChannelListener): void;Remove a message handler previously registered to this channel with channel.subscribe(onMessage).import diagnostics_channel from 'node:diagnostics_channel'; const channel = diagnostics_channel.channel('my-channel'); function onMessage(message, name) { // Received data } channel.subscribe(onMessage); channel.unsubscribe(onMessage); @param onMessageThe previous subscribed handler to remove@returnstrue if the handler was found, false otherwise.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 13:10:36
新闻资讯
成功
标题:数据分析与数据科学的未来, 站长资讯平台
简介:一、分析与数据科学的未来 通过对IADSS联合创始人Usama Fayyad博士在2019年波士顿ODSC的主题演讲后的
-
2026-03-02 14:51:47
综合导航
成功
标题:TSB: 40-second stories support charitable initiatives - Case Study ICF Next
简介:To engage audiences with the brand’s commitment to local cha
-
2026-03-02 16:40:47
综合导航
成功
标题:† Valeur. World English Historical Dictionary
简介:† Valeur. World English Historical Dictionary
-
2026-03-02 16:50:23
综合导航
成功
标题:蓝光显示屏排行榜,蓝光显示屏十大排名推荐 - 京东
简介:围绕着蓝光显示屏排行榜,蓝光显示屏十大排名推荐这个主题,为各位可爱的小宝贝详细介绍相关心意的宝贝,大家一起来看下相关内容
-
2026-03-02 14:56:37
综合导航
成功
标题:MP Women's Maternity Mid Rise Leggings - Black
简介:Shop MP Women
-
2026-03-02 18:55:35
综合导航
成功
标题:第1087章苦尽甘来_至尊龙帝_低调哥_新笔趣阁(56xu.com)
简介:至尊龙帝无防盗章节,作者低调哥,第1087章苦尽甘来内容简要:第1087章苦尽甘来在如此关键时刻,龙傲绝不会手下留情,因
-
2026-03-02 10:48:14
教育培训
成功
标题:童年趣事作文(集合)
简介:在现实生活或工作学习中,大家都尝试过写作文吧,作文是通过文字来表达一个主题意义的记叙方法。那么问题来了,到底应如何写一篇
-
2026-03-02 17:00:06
综合导航
成功
标题:Super Speed Runner - Play The Free Game Online
简介:Super Speed Runner - click to play online. Super Speed Runne
-
2026-03-02 15:06:24
综合导航
成功
标题:RN - Behavioral Psychology · GQR
简介:Contract - W2 Behavioral Health Registered Nurse (RN) Job Lo
-
2026-03-02 09:50:49
综合导航
成功
标题:Личный кабинет
简介:Synology NAS является полнофункциональным сетевым устройство
-
2026-03-02 16:58:44
综合导航
成功
标题:I don’t dare to follow Circle’s 7-fold surge, can I go long on Coinbase? Bee Network
简介:Original article from Artemis Compiled by Odaily Planet Dai
-
2026-03-02 14:16:24
综合导航
成功
标题:【热门】清明节的作文200字汇总六篇
简介:无论是身处学校还是步入社会,大家一定都接触过作文吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、自己能明白的
-
2026-03-02 16:59:14
综合导航
成功
标题:† Vallow deer. World English Historical Dictionary
简介:† Vallow deer. World English Historical Dictionary
-
2026-03-02 16:36:16
游戏娱乐
成功
标题:乐高姐妹宠物店,乐高姐妹宠物店小游戏,4399小游戏 www.4399.com
简介:乐高姐妹宠物店在线玩,乐高姐妹宠物店下载, 乐高姐妹宠物店攻略秘籍.更多乐高姐妹宠物店游戏尽在4399小游戏,好玩记得告
-
2026-03-02 18:06:33
综合导航
成功
标题:杜海云:智慧睡眠产业处于“爆发前夜” 生态构建是破局关键-新华网
简介:杜海云:智慧睡眠产业处于“爆发前夜” 生态构建是破局关键-
-
2026-03-02 14:24:34
综合导航
成功
标题:UID I UX-Agentur für Innovation, Design & Strategie - UID
简介:UID ist eure UX-Agentur für die gesamte Produktentwicklung:
-
2026-03-02 18:55:35
综合导航
成功
标题:AirPods Max - Apple (ES)
简介:La experiencia más avanzada en auriculares de diadema, en c
-
2026-03-02 18:15:24
健康养生
成功
标题:2026招商银行春季校园招聘流程解析,掌握重要招考节点!-高顿教育
简介:招商银行2026年春季校园招聘采用标准化、分批次推进的选拔模式,招聘流程包括简历投递—简历筛选—统一笔试—多轮面试—体检
-
2026-03-02 14:18:38
综合导航
成功
标题:妈妈的三年级作文
简介:无论是身处学校还是步入社会,大家都不可避免地会接触到作文吧,借助作文人们可以反映客观事物、表达思想感情、传递知识信息。你
-
2026-03-02 13:18:04
综合导航
成功
标题:Space launches public sale of its native token SPACE Bee Network
简介:Space is the first prediction market platform in the Solana
-
2026-03-02 17:53:52
综合导航
成功
标题:Aqua Blocks - Play Aqua Blocks Game Online Free
简介:Play Aqua Blocks game online for free on YAD. The game is pl
-
2026-03-02 12:37:01
教育培训
成功
标题:冬天的山作文400字
简介:在生活、工作和学习中,大家都接触过作文吧,作文要求篇章结构完整,一定要避免无结尾作文的出现。怎么写作文才能避免踩雷呢?下
-
2026-03-02 12:50:07
综合导航
成功
标题:† Fewtrer. World English Historical Dictionary
简介:† Fewtrer. World English Historical Dictionary
-
2026-03-02 06:32:04
教育培训
成功
标题:精选玩具的作文300字合集8篇
简介:在日复一日的学习、工作或生活中,大家都不可避免地会接触到作文吧,作文是从内部言语向外部言语的过渡,即从经过压缩的简要的、
-
2026-03-02 12:54:40
图片素材
成功
标题:田野的作文700字 描写田野的作文 关于田野的作文-作文网
简介:作文网精选关于田野的700字作文,包含田野的作文素材,关于田野的作文题目,以田野为话题的700字作文大全,作文网原创名师
-
2026-03-02 12:58:29
综合导航
成功
标题:Blog - FS.com
简介:Learn the latest news & events about FS and products.
-
2026-03-02 12:55:55
综合导航
成功
标题:å¼å³çæ¼é³_å¼å³çææ_å¼å³çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½å¼å³é¢é,ä»ç»å¼å³,å¼å³çæ¼é³,å¼å³æ¯
-
2026-03-02 16:36:30
综合导航
成功
标题:FGS Global - the world’s leading stakeholder strategy firm
简介:Helping organisations, lead, influence and win in decisive m
-
2026-03-02 16:37:00
游戏娱乐
成功
标题:逗小猴开心系列716_逗小猴开心系列716html5游戏_4399h5游戏-4399小游戏
简介:逗小猴开心系列716在线玩,逗小猴开心系列716下载, 逗小猴开心系列716攻略秘籍.更多逗小猴开心系列716游戏尽在4
-
2026-03-02 17:04:05
金融理财
成功
标题:京东理财风险(购买京东理财安全)_火必 Huobi交易所
简介:本篇文章给大家谈谈京东理财风险,以及购买京东理财安全对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。 本文目录一览