import { contextBridge , ipcRenderer , shell } from "electron" ; import { TO_MAIN , FROM_MAIN } from "@pomatez/shareables" ; contextBridge . exposeInMainWorld ( "electron" , { send : ( channel , ... args ) => { if ( TO_MAIN . includes ( channel ) ) { ipcRenderer . send ( channel , ... args ) ; } } , recieve : ( channel , response ) => { if ( FROM_MAIN . includes ( channel ) ) { ipcRenderer . on ( channel , ( event , ... args ) => { return response ( ... args ) ; } ) ; } } , openExternal : ( url , options ? ) => { shell . openExternal ( url ) ; } , } ) ;