- Install
browserify
anduglify-js
:
npm i -g browserify uglify-js
- Generate a standalone file for the module:
browserify --standalone ExportedName --node index.js > module.js
# dependencies | |
node_modules/ | |
.eslintcache | |
# production | |
/release | |
/.vscode | |
/dist | |
# test |
main.obj | |
Win32Minimal.exe |
main.obj | |
Win32Minimal.exe |
const {app, BrowserWindow} = require('electron') | |
app.once('ready', () => { | |
const win = new BrowserWindow({webPreferences: { | |
nodeIntegration: true, enableRemoteModule: true} | |
}) | |
win.loadURL('http://google.com') | |
}) |
How to test: | |
1. npm install -g electron@8 | |
2. electron -v | |
3. npm install | |
3. electron hello.js |
How to test: | |
1. npm install -g electron@8 | |
2. electron -v | |
3. npm install | |
3. electron hello.js |
const {app, nativeImage, webContents, ImageView, TopLevelWindow, WebContentsView} = require('electron') | |
app.once('ready', () => { | |
const win = new TopLevelWindow({}) | |
const imageView = new ImageView() | |
imageView.setImage(__dirname + '/splash.png') | |
win.setContentView(imageView) | |
const contents = webContents.create({}) | |
const web = new WebContentsView(contents) |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Split Pane</title> | |
<link rel="stylesheet" href="split-pane.css" /> | |
<style> | |
html, body { | |
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | |
font-size: 14px; | |
height: 100%; |
[Adblock Plus 2.0] | |
||a.alimama.cn/ | |
||ad.ad-stir.com/ | |
||ad.atdmt.com/ | |
||ad.maist.jp/ | |
||adm.baidu.com/ | |
||ads-a.juicyads.com/ | |
||ads.exoclick.com/ | |
||ads.pubmatic.com/ | |
||ads-union.jd.com/ |
browserify
and uglify-js
:npm i -g browserify uglify-js
browserify --standalone ExportedName --node index.js > module.js