Initial commit
This commit is contained in:
commit
c4626edee4
19 changed files with 11968 additions and 0 deletions
30
main.js
Normal file
30
main.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const { app, BrowserWindow, ipcMain } = require('electron/main');
|
||||
const path = require('node:path');
|
||||
|
||||
console.log('Hello from Electron 👋');
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
},
|
||||
});
|
||||
win.loadFile('index.html');
|
||||
// or use ctrl+shift+i
|
||||
win.webContents.openDevTools();
|
||||
// win.loadURL('chrome://gpu');
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
ipcMain.handle('ping', () => 'pong');
|
||||
createWindow();
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
// when not on mac
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue