Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d20235b

Browse filesBrowse 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
Copy full SHA for d20235b

File tree

Expand file treeCollapse file tree

2 files changed

+11
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-2
lines changed
Open diff view settings
Collapse file

‎lib/diagnostics_channel.js‎

Copy file name to clipboardExpand all lines: lib/diagnostics_channel.js
+1-2Lines 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
function hasSubscribers(name) {
108107
let channel;
109108
const ref = channels[name];
110-
if (ref) channel = WeakRefPrototypeGet(ref);
109+
if (ref) channel = ref.get();
111110
if (!channel) {
112111
return false;
113112
}
Collapse file
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const { channel, hasSubscribers } = require('diagnostics_channel');
5+
6+
const dc = channel('test');
7+
assert.ok(!hasSubscribers('test'));
8+
9+
dc.subscribe(() => {});
10+
assert.ok(hasSubscribers('test'));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.