import type { Ref } from '@vue/reactivity' ; import { ipcMain } from 'electron' ; import type { IpcMainEvent , IpcMainInvokeEvent } from 'electron' ; import { provideIPC } from '../../main/utils/hooks' ; import type { CommasContext } from '../types' ; function on ( this , channel , listener ) { ipcMain . on ( channel , listener ) ; this . $ . app . onCleanup ( ( ) => { ipcMain . removeListener ( channel , listener ) ; } ) ; } function handle ( this , channel , listener ) { ipcMain . handle ( channel , listener ) ; this . $ . app . onCleanup ( ( ) => { ipcMain . removeHandler ( channel ) ; } ) ; } function provide < T > ( this , key , valueRef ) { const cleanup = provideIPC ( key , valueRef ) ; this . $ . app . onCleanup ( ( ) => { cleanup ( ) ; } ) ; } export { on , handle , provide , } ;