场景
用HTML和CSS和JS构建跨平台桌面应用程序的开源库Electron的介绍以及搭建HelloWorld:
https://blog.csdn/BADAO_LIUMANG_QIZHI/article/details/106413828
在上面搭建起来Electron的HelloWorld程序后。
想要在js中使用process对象时提示:
Uncaught ReferenceError: process is not defined
注:
博客:
https://blog.csdn/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。
实现
本来是想在js中通过process获取一些信息的
var btn=document.getElementById('buttonProcess');
btn.onclick=getProcessInfo;
function getProcessInfo()
{
console.log("getProcessInfo**********************");
console.log("getCPUUsage:",process.getCPUUsage);
//cpu操作位数
console.log("arch:",process.arch);
//环境变量
console.log("env:",process.env);
}
如果想使用process对象要在main.js中添加如下代码
nodeIntegration:true
添加位置如下
然后重启项目!重启项目!重启项目!
更多推荐
Electron中 提示:Uncaught ReferenceError: process is not defined
发布评论