electron安装到第一个实例
1、node.js下载,然后安装。下载地址:链接:http://pan.baidu.com/s/1o7TONhS 密码:fosa
2、cmd下输入:npm install electron-prebuilt -g
3、
解压这个文件,然后双击exe

4、创建一个文件夹,里面创建三个文件
package.json,main.js,index.html
内容:
package.json
{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js"
}
main.js
const electron = require('electron');
// Module to control application life.
const {app} = electron;
// Module to create native browser window.
const {BrowserWindow} = electron;
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: , height: });
// and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`);
// Open the DevTools.
win.webContents.openDevTools();
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</body>
</html>
然后将整个文件夹,拖到Electron.exe中,显示效果如下图所示:

我学习的地址是:
http://blog.csdn.net/xuexiiphone/article/details/51445369
感谢技术朋友分享
electron安装到第一个实例的更多相关文章
- 【C# -- OpenCV】Emgu CV 第一个实例
原文 [C# -- OpenCV]Emgu CV 第一个实例 Emgu CV下载地址 http://sourceforge.net/projects/emgucv/files/ 找最新的下就行了,傻瓜 ...
- Vue.js学习和第一个实例
第一个实例效果图: 1.node.js下载,然后安装.下载地址:链接:http://pan.baidu.com/s/1o7TONhS 密码:fosa 2.下载Vue.js.链接:http://pan. ...
- Activity工作流(2)-入门安装运行第一个例子
转: Activity工作流(2)-入门安装运行第一个例子 置顶 2017年05月24日 15:58:50 li_ch_ch 阅读数:24432 版权声明:本文为博主原创文章,未经博主允许不得转载 ...
- JAVA-MyEclipse第一个实例
相关资料: <21天学通Java Web开发> 实例代码: MyEclipse第一个实例1.打开MyEclipse程序.2.在PacKage视图->右击->New|Web Pr ...
- Windows上安装多个MySQL实例(转)
在学习和开发过程中有时候会用到多个MySQL数据库,比如Master-Slave集群.分库分表,开发阶段在一台机器上安装多个MySQL实例就显得方便不少. 在 MySQL教程-基础篇-1.1-Wind ...
- 小白的springboot之路(一)、环境搭建、第一个实例
小白的springboot之路(一).环境搭建.第一个实例 0- 前言 Spring boot + spring cloud + vue 的微服务架构技术栈,那简直是爽得不要不要的,怎么爽法,自行度娘 ...
- 在一台Linux服务器上安装多个MySQL实例(一)--使用mysqld_multi方式
(一)MySQL多实例概述 实例是进程与内存的一个概述,所谓MySQL多实例,就是在服务器上启动多个相同的MySQL进程,运行在不同的端口(如3306,3307,3308),通过不同的端口对外提供服务 ...
- Electron安装过程深入解析(读完此文解决Electron应用无法启动,无法打包的问题)
1. 安装Electron依赖包 开发者往往通过npm install(或 yarn add)指令完成为Node.js工程安装依赖包的工作, 安装Electron也不例外,下面是npm和yarn的安装 ...
- 第四课 Grid Control实验 GC Agent安装(第一台机器部署) 及卸载
3.GC Agent安装(第一台机器部署) 安装Agent 拷贝agent,现在ocm2机器上查找agent.linux 查找文件的方法: find ./ -name agent*linux 把ag ...
随机推荐
- [转][C#]枚举的遍历Enum
// 加载所有颜色 //foreach (Color item in Enum.GetValues(typeof(Color))) foreach (var item in typeof(Color) ...
- docker镜像文件的导入与导出(docker镜像迁移)
1.查看镜像ID # docker images [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE myto ...
- 函数的进阶(动态参数,命名空间和作用域,函数的嵌套,gloabal和nonlocal关键字)
1. 函数参数--动态传参 昨天已经解过了传参, 如果需要给一个函数传参,而参数又是不确定的. 或者我们给一个函数传很多参数, 我的形参就要写很多, 写起来就很麻烦, 这时我们可以考虑使用动态参数.形 ...
- [UE4]制作缩略图
一.创建一个专门用来做缩略图的角色CameraCharacter,不需要实体模型. 二.Auto Possess Player设置为“Player 0” 三.重力比例改成0(这样在天上的时候就不会往下 ...
- UI 性能因素考虑
浏览器的最大并发连接数一般在4到6之间,首先了解影响加载的性能因素: (1)下载的文件太大 (2)发出的请求太多 (3)请求相应不及时 针对这些因素,一般会考虑减少请求次数: (1)对静态文件设置缓存 ...
- Entity Framework执行原生SQL语句
ExecuteSqlCommand为执行命令的接口, SqlQuery 为返回查询结果 1.Database.ExecuteSqlCommand 方法 (String, Object[]) 对数据库执 ...
- 思考-Status management and validation(状态管理与验证)
结合自己的项目,有这么一个模块,这个模块用来添加一个停车场,注册信息又分:基本信息,管理设置,管理员设置3部分组成,每部分都有input=text的输入框,点击保存按钮需要验证各个部分的输入框是否有合 ...
- 用ng-style修改元素的color, size等
1) 在Controller中定义变量myStyle var myStyle={'background-color':'blue'} $scope.myStyle = myStyle; 2) 在HTM ...
- CS229 6.5 Neurons Networks Implements of Sparse Autoencoder
sparse autoencoder的一个实例练习,这个例子所要实现的内容大概如下:从给定的很多张自然图片中截取出大小为8*8的小patches图片共10000张,现在需要用sparse autoen ...
- [十二省联考2019]异或粽子 (可持久化01tire 堆)
/* 查询异或最大值的方法是前缀和一下, 在01trie上二分 那么我们可以对于n个位置每个地方先求出最大的数, 然后把n个信息扔到堆里, 当我们拿出某个位置的信息时, 将他去除当前最大后最大的信息插 ...