TracingChannel.prototype.unsubscribe - Node documentation
method TracingChannel.prototype.unsubscribe
Unstable

Usage in Deno

import { TracingChannel } from "node:diagnostics_channel";
TracingChannel.prototype.unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void

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
  },
});

Parameters

subscribers: TracingChannelSubscribers<ContextType>

Set of TracingChannel Channels subscribers

Return Type

void

true if all handlers were successfully unsubscribed, and false otherwise.