logseq/resources/js/preload.js

20 lines
482 B
JavaScript
Raw Normal View History

const { ipcRenderer, contextBridge } = require('electron')
2021-01-20 15:22:29 +00:00
contextBridge.exposeInMainWorld('api', {
doAction: async (arg) => {
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
}
})