Skip to content
Tauri
Releases

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 >

Source: app.ts:60


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 >

Source: app.ts:80


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 >

Source: app.ts:41


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 >

Source: app.ts:120


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 >

Source: app.ts:100


© 2024 Tauri Contributors. CC-BY / MIT