-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
23 lines (20 loc) · 993 Bytes
/
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
const { contextBridge, ipcRenderer } = require('electron');
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
contextBridge.exposeInMainWorld('electronAPI', {
startServer: (data) => ipcRenderer.send('start-server', data),
stopServer: () => ipcRenderer.send('stop-server'),
onServerStatus: (callback) => ipcRenderer.on('server-status', callback),
onLoadData: (callback) => ipcRenderer.on('load-data', callback),
onSaveData: (callback) => ipcRenderer.on('save-data', callback),
sendSaveData: (data) => ipcRenderer.send('save-data-response', data),
onCloseSaveDate: (callback) => ipcRenderer.on('close-save-data', callback),
sendCloseSaveData: (data) => ipcRenderer.send('close-save-data-response', data)
});
window.addEventListener('DOMContentLoaded', () => {
// Title bar implementation
new Titlebar({
overflow: 'auto',
backgroundColor: TitlebarColor.fromHex('#f0f0f1'),
maximizable: false,
});
});