Skip to main content

Invoke your custom commands.

Table of contents#

Interfaces#

Functions#

invoke#

invoke<T>(cmd: string, args?: InvokeArgs): Promise<T>

Sends a message to the backend.

Type parameters:#

Name
T

Parameters:#

NameTypeDefault valueDescription
cmdstring-The command name.
argsInvokeArgs{}The optional arguments to pass to the command.

Returns: Promise<T>

A promise resolving or rejecting to the backend response.

Defined in: tauri.ts:68


transformCallback#

transformCallback(callback?: (response: any) => void, once?: boolean): string

Transforms a callback function to a string identifier that can be passed to the backend. The backend uses the identifier to eval() the callback.

Parameters:#

NameTypeDefault value
callback?(response: any) => void-
oncebooleanfalse

Returns: string

A unique identifier associated with the callback function.

Defined in: tauri.ts:35