forked from denzelsanchez/ADMIN-ORDER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
36 lines (25 loc) · 776 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { app, BrowserWindow } from 'electron';
let mainWindow;
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
async function createMainWindow() {
mainWindow = new BrowserWindow({ width: 1000, height: 1000 });
try {
await mainWindow.loadFile(`${__dirname}/orders/dashboard.html`);
} catch (error) {
console.error('Error loading file:', error.message);
}
}
app.whenReady().then(() => {
createMainWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createMainWindow();
}
});
});
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit();
});