import { contextBridge , ipcRenderer } from 'electron' ; import type { AnyAction } from 'redux' ; import { Channel } from '../../shared/state/channels' ; contextBridge . exposeInMainWorld ( 'electron' , { send : ( channel , action ) => { const validChannels = [ Channel . PREFS , Channel . PICKER ] ; if ( validChannels . includes ( channel ) ) { ipcRenderer . send ( channel , action ) ; } } , receive : ( channel , function_ ) => { const validChannels = [ Channel . MAIN ] ; if ( validChannels . includes ( channel ) ) { ipcRenderer . on ( channel , ( event , ... arguments_ ) => function_ ( ... arguments_ ) ) ; } } } ) ;