Commit c34a83ea authored by winai buttasart's avatar winai buttasart

add electron desktop application

parent 63e74660
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>สวสัสดีชาวโลก!</title>
</head>
<body>
<h1>สวสัสดีชาวโลก!</h1>
เราใช้ node เวอร์ชัน
<script>
document.write(process.versions.node)
</script>, Chrome เวอร์ชัน
<script>
document.write(process.versions.chrome)
</script>, และ Electron เวอร์ชัน
<script>
document.write(process.versions.electron)
</script>.
</body>
</html>
\ No newline at end of file
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
let win;
function createWindow () {
win = new BrowserWindow({width:800,height:600});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
})
app.on('activate', () => {
if (win === null) {
createWindow();
}
})
This diff is collapsed.
{
"name": "windowapp",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"echo": "echo สวัสดี",
"app": "electron ./"
},
"keywords": [
"windowapp",
"electron"
],
"author": "Nize",
"license": "ISC",
"devDependencies": {
"electron": "^1.8.2"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment