| 1234567891011121314151617181920212223 |
- const { ipcRenderer, contextBridge } = require('electron')
- 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)
- },
- installUpdatesAndQuitApp () {
- ipcRenderer.invoke('install-updates', true)
- }
- })
|