app
Get application metadata.
This package is also accessible with window.__TAURI__.app when build.withGlobalTauri in tauri.conf.json is set to true.
The APIs must be added to tauri.allowlist.app in tauri.conf.json:
{
"tauri": {
"allowlist": {
"app": {
"all": true, // enable all app APIs
"show": true,
"hide": true
}
}
}
}
It is recommended to allowlist only the APIs you use for optimal bundle size and security.
Functions​
getName​
getName():
Promise<string>
Gets the application name.
Example
import { getName } from '@tauri-apps/api/app';
const appName = await getName();
Since: 1.0.0
Returns: Promise<string>
getTauriVersion​
getTauriVersion():
Promise<string>
Gets the Tauri version.
Example
import { getTauriVersion } from '@tauri-apps/api/app';
const tauriVersion = await getTauriVersion();
Since: 1.0.0
Returns: Promise<string>
getVersion​
getVersion():
Promise<string>
Gets the application version.
Example
import { getVersion } from '@tauri-apps/api/app';
const appVersion = await getVersion();
Since: 1.0.0
Returns: Promise<string>
hide​
hide():
Promise<void>
Hides the application on macOS.
Example
import { hide } from '@tauri-apps/api/app';
await hide();
Since: 1.2.0
Returns: Promise<void>
show​
show():
Promise<void>
Shows the application on macOS. This function does not automatically focus any specific app window.
Example
import { show } from '@tauri-apps/api/app';
await show();
Since: 1.2.0
Returns: Promise<void>