session.post(method[, params])
向检查器后端发布消息。
¥Posts a message to the inspector back-end.
import { Session } from 'node:inspector/promises';
try {
const session = new Session();
session.connect();
const result = await session.post('Runtime.evaluate', { expression: '2 + 2' });
console.log(result);
} catch (error) {
console.error(error);
}
// Output: { result: { 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.