@@ -79,6 +79,11 @@ if (channel.hasSubscribers) {
79
79
80
80
#### ` diagnostics_channel.hasSubscribers(name) `
81
81
82
+ <!-- YAML
83
+ added: v15.1.0
84
+ added: v14.17.0
85
+ -->
86
+
82
87
* ` name ` {string|symbol} The channel name
83
88
* Returns: {boolean} If there are active subscribers
84
89
@@ -106,6 +111,11 @@ if (diagnostics_channel.hasSubscribers('my-channel')) {
106
111
107
112
#### ` diagnostics_channel.channel(name) `
108
113
114
+ <!-- YAML
115
+ added: v15.1.0
116
+ added: v14.17.0
117
+ -->
118
+
109
119
* ` name ` {string|symbol} The channel name
110
120
* Returns: {Channel} The named channel object
111
121
@@ -127,6 +137,11 @@ const channel = diagnostics_channel.channel('my-channel');
127
137
128
138
### Class: ` Channel `
129
139
140
+ <!-- YAML
141
+ added: v15.1.0
142
+ added: v14.17.0
143
+ -->
144
+
130
145
The class ` Channel ` represents an individual named channel within the data
131
146
pipeline. It is use to track subscribers and to publish messages when there
132
147
are subscribers present. It exists as a separate object to avoid channel
@@ -137,6 +152,11 @@ with `new Channel(name)` is not supported.
137
152
138
153
#### ` channel.hasSubscribers `
139
154
155
+ <!-- YAML
156
+ added: v15.1.0
157
+ added: v14.17.0
158
+ -->
159
+
140
160
* Returns: {boolean} If there are active subscribers
141
161
142
162
Check if there are active subscribers to this channel. This is helpful if
@@ -167,6 +187,11 @@ if (channel.hasSubscribers) {
167
187
168
188
#### ` channel.publish(message) `
169
189
190
+ <!-- YAML
191
+ added: v15.1.0
192
+ added: v14.17.0
193
+ -->
194
+
170
195
* ` message ` {any} The message to send to the channel subscribers
171
196
172
197
Publish a message to any subscribers to the channel. This will trigger
@@ -194,6 +219,11 @@ channel.publish({
194
219
195
220
#### ` channel.subscribe(onMessage) `
196
221
222
+ <!-- YAML
223
+ added: v15.1.0
224
+ added: v14.17.0
225
+ -->
226
+
197
227
* ` onMessage ` {Function} The handler to receive channel messages
198
228
* ` message ` {any} The message data
199
229
* ` name ` {string|symbol} The name of the channel
@@ -224,6 +254,11 @@ channel.subscribe((message, name) => {
224
254
225
255
#### ` channel.unsubscribe(onMessage) `
226
256
257
+ <!-- YAML
258
+ added: v15.1.0
259
+ added: v14.17.0
260
+ -->
261
+
227
262
* ` onMessage ` {Function} The previous subscribed handler to remove
228
263
229
264
Remove a message handler previously registered to this channel with
0 commit comments