docs: add advanced skills for Vitest, Pinia, and Vue built-ins
Add comprehensive reference documentation for: - Vitest: environments, projects/workspaces, type testing, vi utilities - Pinia: HMR, Nuxt integration, SSR setup - Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
---
|
||||
category: '@Electron'
|
||||
---
|
||||
|
||||
# useIpcRendererOn
|
||||
|
||||
Use [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.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { useIpcRendererOn } from '@vueuse/electron'
|
||||
|
||||
// enable nodeIntegration if you don't provide ipcRenderer explicitly
|
||||
// see: https://www.electronjs.org/docs/api/webview-tag#nodeintegration
|
||||
// remove listener automatically on unmounted
|
||||
useIpcRendererOn('custom-event', (event, ...args) => {
|
||||
console.log(args)
|
||||
})
|
||||
```
|
||||
|
||||
## Type Declarations
|
||||
|
||||
```ts
|
||||
/**
|
||||
* Listens to channel, when a new message arrives listener would be called with listener(event, args...).
|
||||
* [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.
|
||||
*
|
||||
* You need to provide `ipcRenderer` to this function.
|
||||
*
|
||||
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener
|
||||
* @see https://vueuse.org/useIpcRendererOn
|
||||
*/
|
||||
export declare function useIpcRendererOn(
|
||||
ipcRenderer: IpcRenderer,
|
||||
channel: string,
|
||||
listener: IpcRendererListener,
|
||||
): IpcRenderer
|
||||
/**
|
||||
* Listens to channel, when a new message arrives listener would be called with listener(event, args...).
|
||||
* [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.
|
||||
*
|
||||
* `ipcRenderer` will be automatically gotten.
|
||||
*
|
||||
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener
|
||||
* @see https://vueuse.org/useIpcRendererOn
|
||||
*/
|
||||
export declare function useIpcRendererOn(
|
||||
channel: string,
|
||||
listener: IpcRendererListener,
|
||||
): IpcRenderer
|
||||
```
|
||||
Reference in New Issue
Block a user