半小时后我开始研究电子快速入门教程。就像文档告诉我的那样,我创建了这样的文件结构:
离开我在launch.json上更改的文档,使我的项目在Visual Studio代码中的F5上启动:
"type": "node",
"request": "launch",
"name": "Programm starten",
"program": "${workspaceRoot}/main.js",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"runtimeArgs": [
"--enable-logging"
]
我的oncklick() - 函数驻留在index.js中,在index.html中引用:
<script src="index.js"></script>
一切都很好,但是如何让我的index.js-breakpoints在VSC中运行? Main.js-breakpoints应该停止。
THX piccus
答案 0 :(得分:2)
可以像这样更改launch.json并查看此文档 http://electron.rocks/debugging-electron-in-vs-code-revised/
{
"name": "Debug",
"type": "chrome",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"runtimeArgs": [
"${workspaceRoot}",
"--enable-logging",
"--remote-debugging-port=9222"
],
"sourceMaps": false
}
顺便说一句,如果它不是拼写错误,你可以将你的oncKlick功能更改为onclick()