Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorGerhard Stöbich <18708370+Flarna@users.noreply.github.com>2021-09-24 14:47:58 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2021-09-25 19:11:27 +0300
commitb0ef0807e01856d1c0b06e7888bcbdb7380c8fbd (patch)
tree1434e679ed657868549953769ae1489722cf9fa7 /doc/api
parentae876d420cf47157c7a0ef60e49a8e93f478d0d4 (diff)
doc: add version when diagnostics_channel APIs were added
Add a yaml section to document when diagnostics_channel APIs were introduced. PR-URL: https://github.com/nodejs/node/pull/40208 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/diagnostics_channel.md42
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md
index 15ee98fd217..6c4ace3bbd6 100644
--- a/doc/api/diagnostics_channel.md
+++ b/doc/api/diagnostics_channel.md
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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