@@ -79,6 +79,12 @@ if (channel.hasSubscribers) {
79
79
80
80
#### ` diagnostics_channel.hasSubscribers(name) `
81
81
82
+ <!-- YAML
83
+ added:
84
+ - v15.1.0
85
+ - v14.17.0
86
+ -->
87
+
82
88
* ` name ` {string|symbol} The channel name
83
89
* Returns: {boolean} If there are active subscribers
84
90
@@ -106,6 +112,12 @@ if (diagnostics_channel.hasSubscribers('my-channel')) {
106
112
107
113
#### ` diagnostics_channel.channel(name) `
108
114
115
+ <!-- YAML
116
+ added:
117
+ - v15.1.0
118
+ - v14.17.0
119
+ -->
120
+
109
121
* ` name ` {string|symbol} The channel name
110
122
* Returns: {Channel} The named channel object
111
123
@@ -127,6 +139,12 @@ const channel = diagnostics_channel.channel('my-channel');
127
139
128
140
### Class: ` Channel `
129
141
142
+ <!-- YAML
143
+ added:
144
+ - v15.1.0
145
+ - v14.17.0
146
+ -->
147
+
130
148
The class ` Channel ` represents an individual named channel within the data
131
149
pipeline. It is use to track subscribers and to publish messages when there
132
150
are subscribers present. It exists as a separate object to avoid channel
@@ -137,6 +155,12 @@ with `new Channel(name)` is not supported.
137
155
138
156
#### ` channel.hasSubscribers `
139
157
158
+ <!-- YAML
159
+ added:
160
+ - v15.1.0
161
+ - v14.17.0
162
+ -->
163
+
140
164
* Returns: {boolean} If there are active subscribers
141
165
142
166
Check if there are active subscribers to this channel. This is helpful if
@@ -167,6 +191,12 @@ if (channel.hasSubscribers) {
167
191
168
192
#### ` channel.publish(message) `
169
193
194
+ <!-- YAML
195
+ added:
196
+ - v15.1.0
197
+ - v14.17.0
198
+ -->
199
+
170
200
* ` message ` {any} The message to send to the channel subscribers
171
201
172
202
Publish a message to any subscribers to the channel. This will trigger
@@ -194,6 +224,12 @@ channel.publish({
194
224
195
225
#### ` channel.subscribe(onMessage) `
196
226
227
+ <!-- YAML
228
+ added:
229
+ - v15.1.0
230
+ - v14.17.0
231
+ -->
232
+
197
233
* ` onMessage ` {Function} The handler to receive channel messages
198
234
* ` message ` {any} The message data
199
235
* ` name ` {string|symbol} The name of the channel
@@ -224,6 +260,12 @@ channel.subscribe((message, name) => {
224
260
225
261
#### ` channel.unsubscribe(onMessage) `
226
262
263
+ <!-- YAML
264
+ added:
265
+ - v15.1.0
266
+ - v14.17.0
267
+ -->
268
+
227
269
* ` onMessage ` {Function} The previous subscribed handler to remove
228
270
229
271
Remove a message handler previously registered to this channel with
0 commit comments