Skip to main content
unsubscribe - node__diagnostics_channel.d.ts - Node documentation
function unsubscribe

Usage in Deno

```typescript import { unsubscribe } from "node:node__diagnostics_channel.d.ts"; ```
unsubscribe(
name: string | symbol,
onMessage: ChannelListener,
): boolean
Remove a message handler previously registered to this channel with [subscribe](../.././node__diagnostics_channel.d.ts/~/subscribe). ```js import diagnostics_channel from 'node:diagnostics_channel'; function onMessage(message, name) { // Received data } diagnostics_channel.subscribe('my-channel', onMessage); diagnostics_channel.unsubscribe('my-channel', onMessage); ```

Parameters

name: string | symbol
The channel name
onMessage: ChannelListener
The previous subscribed handler to remove

Return Type

boolean
`true` if the handler was found, `false` otherwise.