Electron


설치

Node.js 설치 : https://nodejs.org/ko/download/

Node.js 및 NPM 설치 확인

node -v
npm -v

Electron 전역 설치

npm install electron -g

Electron 설치 확인

electron -v

프로젝트 생성

mkdir test01
cd test01
npm init

package.json 수정

{
  "name": "test01",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

main.js 신규 생성

const {app, BrowserWindow} = require('electron')

let win

app.on('ready', () => {
    win = new BrowserWindow({width:800, height:600})
    win.loadURL(`file://${__dirname}/index.html`)
    win.webContents.openDevTools()
})

app.on('closed', () => {
    win = null
})

index.html 신규 생성

<!DOCTYPE html>
<html>
<head>
    <title>test01</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

참고 : https://www.tutorialspoint.com/electron/index.htm