Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useIpcRendererOn.md
1---2category: '@Electron'3---45# useIpcRendererOn67Use [ipcRenderer.on](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener) with ease and [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.89## Usage1011```ts12import { useIpcRendererOn } from '@vueuse/electron'1314// enable nodeIntegration if you don't provide ipcRenderer explicitly15// see: https://www.electronjs.org/docs/api/webview-tag#nodeintegration16// remove listener automatically on unmounted17useIpcRendererOn('custom-event', (event, ...args) => {18console.log(args)19})20```2122## Type Declarations2324```ts25/**26* Listens to channel, when a new message arrives listener would be called with listener(event, args...).27* [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.28*29* You need to provide `ipcRenderer` to this function.30*31* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener32* @see https://vueuse.org/useIpcRendererOn33*/34export declare function useIpcRendererOn(35ipcRenderer: IpcRenderer,36channel: string,37listener: IpcRendererListener,38): IpcRenderer39/**40* Listens to channel, when a new message arrives listener would be called with listener(event, args...).41* [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.42*43* `ipcRenderer` will be automatically gotten.44*45* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener46* @see https://vueuse.org/useIpcRendererOn47*/48export declare function useIpcRendererOn(49channel: string,50listener: IpcRendererListener,51): IpcRenderer52```53