session.post(method[, params][, callback])


向检查器后端发布消息。callback 将在接收到响应时收到通知。callback 是一个接受两个可选参数的函数:错误和消息特定的结果。

¥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' } 

最新版本的 V8 inspector 协议发布在 Chrome DevTools 协议查看器 上。

¥The latest version of the V8 inspector protocol is published on the Chrome DevTools Protocol Viewer.

Node.js 检查器支持 V8 声明的所有 Chrome 开发者工具协议域。Chrome 开发者工具协议域提供了一个接口,用于与用于检查应用状态和监听运行时事件的运行时代理之一进行交互。

¥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.

向 V8 发送 HeapProfiler.takeHeapSnapshotHeapProfiler.stopTrackingHeapObjects 命令时,不能将 reportProgress 设置为 true

¥You can not set reportProgress to true when sending a HeapProfiler.takeHeapSnapshot or HeapProfiler.stopTrackingHeapObjects command to V8.