Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add version when diagnostics_channel APIs were added #40208

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions doc/api/diagnostics_channel.md
Expand Up @@ -79,6 +79,12 @@ if (channel.hasSubscribers) {

#### `diagnostics_channel.hasSubscribers(name)`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* `name` {string|symbol} The channel name
* Returns: {boolean} If there are active subscribers

Expand Down Expand Up @@ -106,6 +112,12 @@ if (diagnostics_channel.hasSubscribers('my-channel')) {

#### `diagnostics_channel.channel(name)`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* `name` {string|symbol} The channel name
* Returns: {Channel} The named channel object

Expand All @@ -127,6 +139,12 @@ const channel = diagnostics_channel.channel('my-channel');

### Class: `Channel`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

The class `Channel` represents an individual named channel within the data
pipeline. It is use to track subscribers and to publish messages when there
are subscribers present. It exists as a separate object to avoid channel
Expand All @@ -137,6 +155,12 @@ with `new Channel(name)` is not supported.

#### `channel.hasSubscribers`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* Returns: {boolean} If there are active subscribers

Check if there are active subscribers to this channel. This is helpful if
Expand Down Expand Up @@ -167,6 +191,12 @@ if (channel.hasSubscribers) {

#### `channel.publish(message)`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* `message` {any} The message to send to the channel subscribers

Publish a message to any subscribers to the channel. This will trigger
Expand Down Expand Up @@ -194,6 +224,12 @@ channel.publish({

#### `channel.subscribe(onMessage)`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* `onMessage` {Function} The handler to receive channel messages
* `message` {any} The message data
* `name` {string|symbol} The name of the channel
Expand Down Expand Up @@ -224,6 +260,12 @@ channel.subscribe((message, name) => {

#### `channel.unsubscribe(onMessage)`

<!-- YAML
added:
- v15.1.0
- v14.17.0
-->

* `onMessage` {Function} The previous subscribed handler to remove

Remove a message handler previously registered to this channel with
Expand Down