session.post(method[, params][, callback])
method
<string>params
<Object>callback
<Function>
向检查器后端发布消息。
callback
将在接收到响应时收到通知。
callback
是接受两个可选参数(错误和特定于消息的结果)的函数。
session.post('Runtime.evaluate', { expression: '2 + 2' },
(error, { result }) => console.log(result));
// 输出:{ type: 'number', value: 4, description: '4' }
最新版本的 V8 检查器协议发布在 Chrome 开发者工具协议查看器。
Node.js 检查器支持 V8 声明的所有 Chrome 开发者工具协议域。 Chrome 开发者工具协议域提供了一个接口,用于与用于检查应用程序状态和监听运行时事件的运行时代理之一进行交互。
向 V8 发送 HeapProfiler.takeHeapSnapshot
或 HeapProfiler.stopTrackingHeapObjects
命令时,不能将 reportProgress
设置为 true
。
method
<string>params
<Object>callback
<Function>
Posts a message to the inspector back-end. callback
will be notified when
a response is received. callback
is a function that accepts two optional
arguments: error and message-specific result.
session.post('Runtime.evaluate', { expression: '2 + 2' },
(error, { result }) => console.log(result));
// Output: { type: 'number', value: 4, description: '4' }
The latest version of the V8 inspector protocol is published on the Chrome DevTools Protocol Viewer.
Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events.
You can not set reportProgress
to true
when sending a
HeapProfiler.takeHeapSnapshot
or HeapProfiler.stopTrackingHeapObjects
command to V8.