MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/diagnostics_channel.js:90–121  ·  view source on GitHub ↗
(activeChannel, data)

Source from the content-addressed store, hash-verified

88 #stack;
89
90 constructor(activeChannel, data) {
91 // eslint-disable-next-line no-restricted-globals
92 using stack = new DisposableStack();
93
94 // Enter stores using withScope
95 if (activeChannel._stores) {
96 for (const entry of activeChannel._stores.entries()) {
97 const store = entry[0];
98 const transform = entry[1];
99
100 let newContext = data;
101 if (transform) {
102 try {
103 newContext = transform(data);
104 } catch (err) {
105 process.nextTick(() => {
106 triggerUncaughtException(err, false);
107 });
108 continue;
109 }
110 }
111
112 stack.use(store.withScope(newContext));
113 }
114 }
115
116 // Publish data
117 activeChannel.publish(data);
118
119 // Transfer ownership of the stack
120 this.#stack = stack.move();
121 }
122
123 [SymbolDispose]() {
124 this.#stack[SymbolDispose]();

Callers

nothing calls this directly

Calls 4

transformFunction · 0.50
entriesMethod · 0.45
withScopeMethod · 0.45
publishMethod · 0.45

Tested by

no test coverage detected