-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpreload.js
More file actions
26 lines (22 loc) · 1010 Bytes
/
preload.js
File metadata and controls
26 lines (22 loc) · 1010 Bytes
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
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
onOpenAudioDialog: (callback) =>
ipcRenderer.on('open-audio-dialog', callback),
onAppendAudioDialog: (callback) =>
ipcRenderer.on('append-audio-dialog', callback),
// File handling APIs
showOpenDialog: (options) => ipcRenderer.invoke('show-open-dialog', options),
readFile: (filePath) => ipcRenderer.invoke('read-file', filePath),
// Auto-updater APIs
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
onUpdateAvailable: (callback) => ipcRenderer.on('update-available', callback),
onUpdateDownloaded: (callback) =>
ipcRenderer.on('update-downloaded', callback),
onDownloadProgress: (callback) =>
ipcRenderer.on('download-progress', callback),
installUpdate: () => ipcRenderer.invoke('install-update'),
// Utility functions
isElectron: true,
platform: process.platform,
});