Skip to content

Commit d20235b

Browse files
Lxxyxdanielleadams
authored andcommitted
lib: fix diagnostics_channel hasSubscribers error
Fixes: #36598 PR-URL: #36599 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 93237c5 commit d20235b

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎lib/diagnostics_channel.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const {
88
ObjectGetPrototypeOf,
99
ObjectSetPrototypeOf,
1010
SymbolHasInstance,
11-
WeakRefPrototypeGet
1211
}=primordials;
1312

1413
const{
@@ -107,7 +106,7 @@ function channel(name) {
107106
functionhasSubscribers(name){
108107
letchannel;
109108
constref=channels[name];
110-
if(ref)channel=WeakRefPrototypeGet(ref);
109+
if(ref)channel=ref.get();
111110
if(!channel){
112111
returnfalse;
113112
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
constassert=require('assert');
4+
const{ channel, hasSubscribers }=require('diagnostics_channel');
5+
6+
constdc=channel('test');
7+
assert.ok(!hasSubscribers('test'));
8+
9+
dc.subscribe(()=>{});
10+
assert.ok(hasSubscribers('test'));

0 commit comments

Comments
 (0)