tracingChannel.unsubscribe(subscribers)


新增于: v19.9.0, v18.19.0

从相应通道取消订阅功能集合的助手。这与在每个通道上单独调用 channel.unsubscribe(onMessage) 相同。

\Helper to unsubscribe a collection of functions from the corresponding channels. This is the same as calling channel.unsubscribe(onMessage) on each channel individually.

import diagnostics_channel from 'node:diagnostics_channel';
const channels = diagnostics_channel.tracingChannel('my-channel');
channels.unsubscribe({
 start(message) {
 // Handle start message
 },
 end(message) {
 // Handle end message
 },
 asyncStart(message) {
 // Handle asyncStart message
 },
 asyncEnd(message) {
 // Handle asyncEnd message
 },
 error(message) {
 // Handle error message
 },
});const diagnostics_channel = require('node:diagnostics_channel');
const channels = diagnostics_channel.tracingChannel('my-channel');
channels.unsubscribe({
 start(message) {
 // Handle start message
 },
 end(message) {
 // Handle end message
 },
 asyncStart(message) {
 // Handle asyncStart message
 },
 asyncEnd(message) {
 // Handle asyncEnd message
 },
 error(message) {
 // Handle error message
 },
});

AltStyle によって変換されたページ (->オリジナル) /