-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
26 lines (24 loc) · 1.56 KB
/
preload.js
File metadata and controls
26 lines (24 loc) · 1.56 KB
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
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electron', {
setMiniMode: () => ipcRenderer.send('set-mini-mode'),
setNormalMode: () => ipcRenderer.send('set-normal-mode'),
onGlobalShortcut: (callback) => ipcRenderer.on('global-shortcut-triggered', callback),
panic: () => ipcRenderer.send('panic-action'),
onAutoTypeRequest: (callback) => ipcRenderer.on('auto-type-request', callback),
performAutoType: (data) => ipcRenderer.send('perform-auto-type', data),
selectBackupFolder: () => ipcRenderer.invoke('select-backup-folder'),
saveBackupFile: (path, content) => ipcRenderer.invoke('save-backup-file', path, content),
loadBackupFile: (path) => ipcRenderer.invoke('load-backup-file', path),
checkBiometry: () => ipcRenderer.invoke('check-biometry'),
promptBiometry: (reason) => ipcRenderer.invoke('prompt-biometry', reason),
encryptKey: (key) => ipcRenderer.invoke('encrypt-key', key),
decryptKey: (encryptedKey) => ipcRenderer.invoke('decrypt-key', encryptedKey),
getDeviceId: () => ipcRenderer.invoke('get-device-id'),
// File System
saveFile: (name, data) => ipcRenderer.invoke('save-file', { name, data }),
// Extension Hooks
onExtensionSearchRequest: (callback) => ipcRenderer.on('extension-search-request', callback),
sendExtensionSearchResponse: (results) => ipcRenderer.send('extension-search-response', results),
onExtensionSaveRequest: (callback) => ipcRenderer.on('extension-save-request', callback),
sendExtensionSaveResponse: (payload) => ipcRenderer.send('extension-save-response', payload)
});