import { ipcRenderer } from 'electron' ; import { WindowIpcTopic } from '@portal-windows/core' ; export function preload ( ) { window . electronPublish = ( msg , ... args ) => { try { ipcRenderer . send ( msg , ... args ) ; } catch ( e ) { console . warn ( e ) ; } } ; window . electronSubscribe = ( channel , listener ) => { ipcRenderer . on ( channel , listener ) ; } ; window . electronUnsubscribe = ( channel , func ? ) => { if ( func ) ipcRenderer . removeListener ( channel , func ) ; else ipcRenderer . removeAllListeners ( channel ) ; } ; }