method TracingChannel.prototype.subscribe
Unstable
Usage in Deno
import { TracingChannel } from "node:diagnostics_channel";
TracingChannel.prototype.subscribe(subscribers: TracingChannelSubscribers<ContextType>): void
Helper to subscribe a collection of functions to the corresponding channels.
This is the same as calling channel.subscribe(onMessage)
on each channel
individually.
import diagnostics_channel from 'node:diagnostics_channel';
const channels = diagnostics_channel.tracingChannel('my-channel');
channels.subscribe({
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
},
});
subscribers: TracingChannelSubscribers<ContextType>
Set of TracingChannel Channels
subscribers
void