mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
20 lines
626 B
TypeScript
20 lines
626 B
TypeScript
import { contextBridge, ipcRenderer } from 'electron';
|
|
|
|
contextBridge.exposeInMainWorld('overlayAPI', {
|
|
setIgnoreMouseEvents: (ignore: boolean) => {
|
|
ipcRenderer.send('overlay-set-ignore-mouse', ignore);
|
|
},
|
|
showMainWindow: () => {
|
|
ipcRenderer.send('overlay-show-main-window');
|
|
},
|
|
onUpdateContent: (callback: (data: any) => void) => {
|
|
const listener = (event: Electron.IpcRendererEvent, data: any): void =>
|
|
callback(data);
|
|
ipcRenderer.on('update-content', listener);
|
|
|
|
// Return cleanup function
|
|
return () => {
|
|
ipcRenderer.removeListener('update-content', listener);
|
|
};
|
|
},
|
|
});
|