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