boundedChannel.unsubscribe(handlers)


  • handlers <Object> 通道订阅者集合
  • 返回:<boolean> true 如果所有处理程序都成功取消订阅,否则 false

取消订阅有界通道事件。这等同于对每个通道单独调用 channel.unsubscribe(onMessage)

🌐 Unsubscribe from the bounded channel events. This is equivalent to calling channel.unsubscribe(onMessage) on each channel individually.

import { boundedChannel } from 'node:diagnostics_channel';

const wc = boundedChannel('my-operation');

const handlers = {
  start(message) {},
  end(message) {},
};

wc.subscribe(handlers);
wc.unsubscribe(handlers);const { boundedChannel } = require('node:diagnostics_channel');

const wc = boundedChannel('my-operation');

const handlers = {
  start(message) {},
  end(message) {},
};

wc.subscribe(handlers);
wc.unsubscribe(handlers);