openCountdown/electronAssets/windowPreload.js
grey 013ad881d3 - add gui electron application
! sometimes the tray icon does not open it's context menu
2022-08-18 22:00:24 +02:00

12 lines
343 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('api', {
send: (channel, data) => {
// whitelist channels
ipcRenderer.send(channel, data)
},
receive: (channel, func) => {
// Deliberately strip event as it includes `sender`
ipcRenderer.on(channel, (event, ...args) => func(...args))
},
})