Skip to main content
Channel.prototype.hasSubscribers - node__diagnostics_channel.d.ts - Node documentation
property Channel.prototype.hasSubscribers

Usage in Deno

```typescript import { Channel } from "node:node__diagnostics_channel.d.ts"; ```
Check if there are active subscribers to this channel. This is helpful if the message you want to send might be expensive to prepare. This API is optional but helpful when trying to publish messages from very performance-sensitive code. ```js import diagnostics_channel from 'node:diagnostics_channel'; const channel = diagnostics_channel.channel('my-channel'); if (channel.hasSubscribers) { // There are subscribers, prepare and publish message } ```

Type

boolean