-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
17 lines (15 loc) · 899 Bytes
/
preload.js
File metadata and controls
17 lines (15 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const { contextBridge, ipcRenderer} = require('electron');
contextBridge.exposeInMainWorld(
'myAPI', {
invokeNewNote: () => ipcRenderer.invoke('newNote'),
invokeScanNote: () => ipcRenderer.invoke('scanNote'),
invokeSaveTitle: (titleContent) => ipcRenderer.invoke('saveTitle', titleContent),
invokeSaveContent: (mainContent) => ipcRenderer.invoke('saveContent', mainContent),
invokeSwitchNote: (title) => ipcRenderer.invoke('switchNote', title),
invokeUpdateSidebar: () => ipcRenderer.invoke('updateSidebar'),
invokeDialog_Custom: (options) => ipcRenderer.invoke('dialog_Custom', options),
invokeGetFlashcards: () => ipcRenderer.invoke('getFlashcards'),
onUpdateMainNote: (callback) => ipcRenderer.on('updateMainNote', callback),
onUpdateSidebar: (callback) => ipcRenderer.on('updateSidebar', callback),
}
);