Invoke your custom commands.
This package is also accessible with window.__TAURI__.tauri
when tauri.conf.json > build > withGlobalTauri
is set to true.
#
Interfaces#
Functions#
convertFileSrc▸ convertFileSrc(filePath
): string
Convert a device file path to an URL that can be loaded by the webview.
Note that asset:
must be allowed on the csp
value configured on tauri.conf.json
.
#
ParametersName | Type | Description |
---|---|---|
filePath | string | the file path. On Windows, the drive name must be omitted, i.e. using /Users/user/file.png instead of C:/Users/user/file.png . |
#
Returnsstring
the URL that can be used as source on the webview
#
Defined in#
invoke▸ invoke<T
>(cmd
, args?
): Promise
<T
>
Sends a message to the backend.
#
Type parametersName |
---|
T |
#
ParametersName | Type | Description |
---|---|---|
cmd | string | The command name. |
args | InvokeArgs | The optional arguments to pass to the command. |
#
ReturnsPromise
<T
>
A promise resolving or rejecting to the backend response.
#
Defined in#
transformCallback▸ transformCallback(callback?
, once?
): 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.
#
ParametersName | Type | Default value |
---|---|---|
callback? | (response : any ) => void | undefined |
once | boolean | false |
#
Returnsstring
A unique identifier associated with the callback function.