LoginSignup
11
11

More than 5 years have passed since last update.

Electron1.3.xの最小構成

Last updated at Posted at 2016-07-30
package.json
{
  "name": "my-electron-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "electron index.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron-packager": "^7.3.0",
    "electron-prebuilt": "^1.3.1"
  }
}
index.js
const {app, BrowserWindow} = require('electron');

let win;

function createWindow() {
  win = new BrowserWindow({width: 800, height: 600});
  win.loadURL(`file://${__dirname}/index.html`);
  win.on('closed', () => { win = null; });
}

app.on('ready', createWindow);
app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});
index.html
<!doctype html>
<html>
  <body>
    <h1>my-electron-app</h1>
  </body>
</html>

以上のファイルをプロジェクトのルートディレクトリに作成し、$ npm install$ npm run startで起動します。お疲れ様でした。

11
11
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11