-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
12 lines (11 loc) · 734 Bytes
/
Copy pathpreload.js
File metadata and controls
12 lines (11 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
const { contextBridge, ipcRenderer, shell } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
selectDirectory: () => ipcRenderer.invoke('select-directory'),
watchDebugLog: (directory) => ipcRenderer.invoke('watch-debug-log', directory),
clearDebugLog: (directory) => ipcRenderer.invoke('clear-debug-log', directory),
onDebugLogUpdated: (callback) => ipcRenderer.on('debug-log-updated', (event, content) => callback(content)),
quitApp: () => ipcRenderer.invoke('quit-app'),
getRecentDirectories: () => ipcRenderer.invoke('get-recent-directories'),
selectRecentDirectory: (directory) => ipcRenderer.invoke('select-recent-directory', directory),
openExternal: (url) => shell.openExternal(url)
});