boundedChannel.unsubscribe(handlers)
handlers<Object> 通道订阅者集合start<Function> 开始事件订阅者end<Function> 结束事件订阅者
- 返回:<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);