问题描述
我想在我的 Electron 应用程序的开发工具中启用“自定义格式化程序”设置,如下所述:https://github.com/MarshallOfSound/electron-devtools-installer/issues/36#issuecomment-285956783
手动启用设置是可能的,但我想在开发工具打开时自动这样做,这样其他开发人员就不必记住自己做。
是否可以通过 dev tools commands 使用 Electron Debugger
API 自动启用此设置?
我发现在 Chromium 中单击开发工具中的复选框会通过 this code path,但除此之外我无法弄清楚如何使用调试器 API 以编程方式执行此操作。
我尝试了以下方法:
mainWindow.webContents.once("dom-ready",async () => {
const debug = mainWindow.webContents.debugger;
try {
debug.attach("1.1");
} catch (err) {
// debugger may already be attached
}
try {
await debug.sendCommand("Runtime.enable");
await debug.sendCommand("Runtime.setCustomObjectFormatterEnabled",{ enabled: true });
} finally {
debug.detach();
}
});
但设置似乎没有改变。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)