import type { Channel } from '../../../shared/state/channels' ; import type { Middleware } from '../../../shared/state/model' ; import { customWindow } from '../custom.window' ; /**
 * Pass actions between main and renderers
 */ export const busMiddleware = ( channel ) : Middleware => ( ) => ( next ) => ( action ) => { /**
     * Move to next middleware
     */ const result = next ( action ) ; if ( action . meta ?. channel === channel ) { customWindow . electron . send ( channel , action ) ; } return result ; } ;