调试工具
Last updated
Was this helpful?
Last updated
Was this helpful?
用于Chrome远程调试协议的替代传输。
进程:
Chrome调试工具在JavaScript运行时具有,允许与页面交互并对其进行检测。
debugger.attach([protocolVersion])
用途:将调试器附加到
webContents
protocolVersion
String(可选) - 请求的调试协议版本。
debugger.isAttached()
用途:判断调试器是否已附加到
webContents
debugger.detach()
用途:从
webContents
里分离调试器
debugger.sendCommand(method[, commandParams, callback])
用途:发送给定命令到调试目标
method
String - 方法名, 名称通过远程调试协议定义.
commandParams
Object (可选) -带请求参数的JSON对象。
callback
Function (可选) - 响应方法
error
Object - 错误后的指示命令
result
Any - 由远程调试协议中的命令描述的“returns”属性定义的响应。
触发:在
webContents
关闭 或webContents
调用调试工具时
event
Event
reason
String -分离调试器的原因。
触发:调试提交报告时
event
Event
method
String - 方法名
params
Object - 由远程调试协议中的 parameters
属性定义的事件参数。
[webContents.findInPage
]: web-contents.md#contentsfindinpagetext-options