Skip to content

h5-coder/electron-template

Repository files navigation

客户端 electron-template

electron-template项目用于作为客户端开的模版。

搭建跨平台桌面应用

仅仅使用JavaScript,HTML以及CSS


1.软件成分:

Electron: 1.7.5     Node: 7.9.0     Chromium: 58.0.3029.110     V8:5.8.283.38

2.前期工作

  1. git
  2. node.js
  3. node-gyp(全局安装)
  4. python(需要配置环境变量)
  5. 翻墙工具

3 搭建开发环境


# Clone the Quick Start repository
$ git clone -b develop http://192.168.9.66/Juzix-ethereum/electron-template
# Go into the repository
$ cd electron-template
# Install the dependencies and run
$ npm install&&npm run dev

但是如果有小伙伴没翻墙,被拦在的寡妇网内,会npm install导致失败,那就用下面这个办法吧(换了源也不好使的话)

淘宝的镜像安装

用了cnpm 安装依赖后, 打包会有问题, 打包会有问题, 打包会有问题, 找不到依赖的路径!!!

4.ipc

//main.js
ipcMain.on('asynchronous-message', (event, arg) => {
  console.log(arg);  // prints "ping"
  event.sender.send('asynchronous-reply', 'pong');
});

ipcMain.on('synchronous-message', (event, arg) => {
  console.log(arg);  // prints "ping"
  event.returnValue = 'pong';
});
const {ipcRenderer} = require('electron');

console.log(ipcRenderer.sendSync('synchronous-message', 'ping'));

ipcRenderer.on('asynchronous-reply', (event, arg) => {
    console.log(arg); // prints "pong"
});

ipcRenderer.send('asynchronous-message', 'ping');

5.钱包和U-key

6.合约API

7.相关链接

  1. electron官网

    https://electron.atom.io/
  2. electron中文文档

    https://github.com/electron/electron/tree/1-6-x/docs-translations/zh-CN

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:9080
npm run dev

# build electron application for production
npm run build