-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for TracingChannel#hasSubscribers
, test Node.js v22
#11
Conversation
TracingChannel#hasSubscribers
TracingChannel#hasSubscribers
, test Node.js v22
dc.tracingChannel = function() { | ||
const tc = tracingChannel(...arguments); | ||
|
||
Object.defineProperty(tc, 'hasSubscribers', { // TODO: on prototype? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do it on the prototype by creating a throwaway TracingChannel and getting its prototype?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just crazy enough to work
checks.js
Outdated
// if there is a TracingChannel#hasSubscribers() method | ||
// @see https://github.com/nodejs/node/pull/51915 | ||
// TODO: note that we still need to add the TC early exit from this same version | ||
function hasTracingChannelHasSubscribersMethod() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasSubscribers is an accessor/property, not a method.
d4ab58f
to
69fec35
Compare
{ | ||
const fauxTrCh = dc.tracingChannel('dc-polyfill-faux'); | ||
|
||
const TracingChannel = ObjectGetPrototypeOf(fauxTrCh); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe TracingChannelPrototype
or tracingChannelPrototype
, or proto
or something else to indicate that it's the prototype object, and not the class/constructor.
69fec35
to
64e48fd
Compare
diagnostics_channel
changes landed in Node.js in diagnostics_channel: early-exit tracing channel trace methods nodejs/node#51915TracingChannel#hasSubscribers
helper method available in Node.js v22 and v20.13