Skip to content

useIpcRendererInvoke

Category
Export Size
328 B
Package
@reause/electron
Last Changed
5 days ago

Reactive ipcRenderer.invoke API result. Make asynchronous operations look synchronous.

Demo

Usage

tsx
import { 
useIpcRendererInvoke
} from '@reause/electron'
// enable nodeIntegration if you don't provide ipcRenderer explicitly // see: https://www.electronjs.org/docs/api/webview-tag#nodeintegration const
result
=
useIpcRendererInvoke
<string>('custom-channel', 'some data')

Type Declarations

ts
export function useIpcRendererInvoke<T>(ipcRenderer: IpcRenderer, channel: string, ...args: any[]): T | null

export function useIpcRendererInvoke<T>(channel: string, ...args: any[]): T | null

Source

Source · Demo · VueUse

Contributors

hairyf

Changelog

v0.1.0 on
62b12 - fix(electron): resolve useIpcRendererInvoke audit findings (#809)
9a6d8 - feat(electron): add useIpcRenderer, useIpcRendererInvoke, useIpcRendererOn (#148, #149, #150)

Released under the MIT License. v0.1.8