-
Notifications
You must be signed in to change notification settings - Fork 0
/
preload.cjs
22 lines (19 loc) · 1.03 KB
/
preload.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { contextBridge, ipcRenderer } = require('electron');
const Store = require('electron-store');
const store = new Store();
contextBridge.exposeInMainWorld('electron', {
getProtocolUrl: () =>
ipcRenderer.invoke('get-protocol-url'),
evaluateForMoveClassification: async (...args) =>
await ipcRenderer.invoke('evaluate-for-move-classification', ...args),
setMoveClassificationEvaluationCallback: callback =>
ipcRenderer.removeAllListeners('move-classification-evaluation-callback').on('move-classification-evaluation-callback', (event, ...args) => callback(...args)),
evaluateForLiveAnalysis: async (...args) =>
await ipcRenderer.invoke('evaluate-for-live-analysis', ...args),
setLiveAnalysisEvaluationCallback: callback =>
ipcRenderer.removeAllListeners('live-analysis-evaluation-callback').on('live-analysis-evaluation-callback', (event, ...args) => callback(...args)),
store: {
get: (...args) => store.get(...args),
set: (...args) => store.set(...args),
},
});