2021-01-21 07:09:45 +00:00
|
|
|
const { ipcRenderer, contextBridge } = require('electron')
|
2021-01-20 15:22:29 +00:00
|
|
|
|
|
|
|
contextBridge.exposeInMainWorld('api', {
|
|
|
|
doAction: async (arg) => {
|
2021-01-21 07:09:45 +00:00
|
|
|
return await ipcRenderer.invoke('main', arg)
|
|
|
|
},
|
|
|
|
|
|
|
|
checkForUpdates: async (...args) => {
|
|
|
|
await ipcRenderer.invoke('check-for-updates', ...args)
|
|
|
|
},
|
|
|
|
|
|
|
|
setUpdatesCallback (cb) {
|
|
|
|
if (typeof cb !== 'function') return
|
|
|
|
|
|
|
|
const channel = 'updates-callback'
|
|
|
|
ipcRenderer.removeAllListeners(channel)
|
|
|
|
ipcRenderer.on(channel, cb)
|
2021-01-20 15:22:29 +00:00
|
|
|
}
|
2021-01-21 07:09:45 +00:00
|
|
|
})
|