MCPcopy Index your code
hub / github.com/nodejs/node / #onMessage

Method #onMessage

lib/inspector.js:84–106  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

82 }
83
84 #onMessage(message) {
85 const parsed = JSONParse(message);
86 try {
87 if (parsed.id) {
88 const callback = this.#messageCallbacks.get(parsed.id);
89 this.#messageCallbacks.delete(parsed.id);
90 if (callback) {
91 if (parsed.error) {
92 return callback(
93 new ERR_INSPECTOR_COMMAND(parsed.error.code, parsed.error.message),
94 );
95 }
96
97 callback(null, parsed.result);
98 }
99 } else {
100 this.emit(parsed.method, parsed);
101 this.emit('inspectorNotification', parsed);
102 }
103 } catch (error) {
104 process.emitWarning(error);
105 }
106 }
107
108 /**
109 * Posts a message to the inspector back-end.

Callers 2

connectMethod · 0.95
connectToMainThreadMethod · 0.95

Calls 4

getMethod · 0.65
deleteMethod · 0.65
callbackFunction · 0.50
emitMethod · 0.45

Tested by

no test coverage detected