-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
60 lines (41 loc) · 1.37 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { app, dialog, ipcMain } = require('electron');
const MainWindow = require('./app/main-window');
const AutoUpdater = require('./app/auto-updater');
const Notification = require('./app/notification');
const GlobalShortcut = require('./app/global-shortcut');
const fs = require('fs');
const isPackaged = !process.defaultApp;
// https://www.electronjs.org/docs/latest/api/clipboard
fs.writeFileSync('run.txt', isPackaged.toString());
// const path = require("node:path");
ipcMain.on('click', ($event, data) => $event.reply('click', data));
let window;
let autoUpdater;
let notification;
let globalShortcut;
function createWindow() {
window = new MainWindow();
autoUpdater = new AutoUpdater(window);
notification = new Notification();
globalShortcut = new GlobalShortcut();
// window.openDevTools();
}
app.whenReady().then(async () => {
createWindow();
// globalShortcut.Register();
autoUpdater.checkForUpdates().then();
// notification.show('hi', 'خوش آمدید'); // .then((x) => notification.show('hi', '3333333333333333333333'));
// let code = `
// var p = document.getElementById("message");
// p.innerHTML = "I am the changed text. ";
// `;
// win.webContents.executeJavaScript(code);
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
// app.on('will-quit', () => {
// globalShortcut.Unregister();
// });