Today I have just started to learn Electron.
I don't understand more about it but I think:
Inside Atom.io I have created a Folder called Demo which has 3 files as follows:
Demo
|--package.json
|--main.js
|--index.html
In package.json:
{
"name" : "Demo",
"version" : "0.1.0",
"main" : "main.js"
}
In main.js:
const electron = require('electron');
const {app} = electron;
const {BrowserWindow} = electron;
let win;
function createWindow() {
win = new BrowserWindow({width: 800, height: 600});
win.loadURL(`file://${__dirname}/index.html`);
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
In index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
Now, I want to know that how can I run this project? Do I need to install anything else to run it?
I am using Windows 8.1
Electron is not a language. It's a framework to build cross-platform desktop applications with web technologies (HTML, CSS, JS) built with NodeJS.
So when to build app with Electron, you have both ElectronAPI and npm ecosystem at your disposal.
To run your Electron app, you can follow:
and/or clone electron-quick-start repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With