-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
37 lines (32 loc) · 1.41 KB
/
preload.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
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
getInstalledThemes: () => ipcRenderer.invoke('get-installed-themes'),
getCustomCssSource: () => ipcRenderer.invoke('get-custom-css-source'),
isAlreadyPatched: () => ipcRenderer.invoke('is-already-patched'),
patchDiscord: () => ipcRenderer.invoke('patch-discord'),
resetAsar:() => ipcRenderer.invoke('reset-asar'),
updateCssFile: (text) => ipcRenderer.send('update-css-text', text),
updateFont: (font_src) => ipcRenderer.send('update-font', font_src),
loadTheme: (theme_name) => ipcRenderer.send('load-theme', theme_name),
updateHeaderIcon: (data) => ipcRenderer.send("update-header-icon", data),
});
window.addEventListener('DOMContentLoaded', () => {
const closeBtn = document.getElementById('closeBtn');
const minimizeBtn = document.getElementById('minimizeBtn');
const maximizeBtn = document.getElementById('maximizeBtn');
if (closeBtn) {
closeBtn.addEventListener('click', () => {
ipcRenderer.send('closeApp');
});
}
if (minimizeBtn) {
minimizeBtn.addEventListener('click', () => {
ipcRenderer.send('minimizeApp');
});
}
if (maximizeBtn) {
maximizeBtn.addEventListener('click', () => {
ipcRenderer.send('maximizeApp');
});
}
});