Size: 370
Comment:
|
Size: 1473
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
'''`electron(1)`''' is a framework for Node application. |
|
Line 9: | Line 11: |
== electron-store == | == Example == |
Line 11: | Line 13: |
A simple data persistence solution for Electron apps, using minimal dependencies. It writes to `config.json` in `app.getPath('userData')`. If the renderer needs access to the store, try: |
A basic `election` application looks like: |
Line 16: | Line 16: |
const win = new BrowserWindow({ enableRemoteModule: true }) | const { app, BrowserWindow } = require("electron"); const path = require("path"); let win; function init() { win = NewBrowserWindow({ width: 800, height: 600, webPreferences: { contextIsolation: true, nodeIntegration: false, preload: path.join(__dirname, "preload.js") } }); win.loadFile(path.join(__dirname, "index.html")); win.on("closed", () => { win = null; }); } app.on("ready", init); app.on("window-all-closed", () => { if (process.platform !== "darwin") { app.quit(); } }); app.on("activate", () => { if (win === null) { init() } }); |
Line 18: | Line 52: |
---- == Installation == Using `npm(1)`: {{{ npm install --save-dev electron }}} ---- == Usage == === Utilities === * [[Node/Electron/App|app]] * [[Node/Electron/BrowserWindow|BrowserWindow]] * [[Node/Electron/Dialog|dialog]] * [[Node/Electron/IpcMain|ipcMain]] * [[Node/Electron/IpcRenderer|ipcRenderer]] * [[Node/Electron/Menu|Menu]] * [[Node/Electron/Shell|shell]] === Distribution === TODO: copy from [[https://www.electronjs.org/docs/tutorial/application-distribution#manual-distribution]]. See also [[Node/ElectronBuilder|electron-builder]]. |
Electron
electron(1) is a framework for Node application.
Contents
Example
A basic election application looks like:
const { app, BrowserWindow } = require("electron"); const path = require("path"); let win; function init() { win = NewBrowserWindow({ width: 800, height: 600, webPreferences: { contextIsolation: true, nodeIntegration: false, preload: path.join(__dirname, "preload.js") } }); win.loadFile(path.join(__dirname, "index.html")); win.on("closed", () => { win = null; }); } app.on("ready", init); app.on("window-all-closed", () => { if (process.platform !== "darwin") { app.quit(); } }); app.on("activate", () => { if (win === null) { init() } });
Installation
Using npm(1):
npm install --save-dev electron
Usage
Utilities
Distribution
TODO: copy from https://www.electronjs.org/docs/tutorial/application-distribution#manual-distribution.
See also electron-builder.