mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 09:23:17 +01:00
14 lines
464 B
JavaScript
14 lines
464 B
JavaScript
const { ipcRenderer, contextBridge } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('ipcRenderer', {
|
|
invoke: (channel, ...args) => ipcRenderer.invoke(channel, ...args),
|
|
on: (channel, handler) => {
|
|
// Deliberately strip event as it includes `sender`
|
|
const subscription = (event, ...args) => handler(...args);
|
|
ipcRenderer.on(channel, subscription);
|
|
|
|
return () => {
|
|
ipcRenderer.removeListener(channel, subscription);
|
|
};
|
|
}
|
|
}); |