Munsubscribe
Bun

method

diagnostics_channel.BoundedChannel.unsubscribe

handlers: PartialOptions<BoundedChannelSubscribers<ContextType>>
): boolean;

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);
@param handlers

Set of channel subscribers

@returns

true if all handlers were successfully unsubscribed, false otherwise.

Referenced types

interface BoundedChannelSubscribers<ContextType extends object>

  • end: (message: ContextType) => void
  • start: (message: ContextType) => void