跳转到内容
Tauri

app

此内容尚不支持你的语言。

Bundle type of the current application.

App: "app";

macOS app bundle

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L43

AppImage: "appimage";

Linux AppImage

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L41

Deb: "deb";

Linux Debian package

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L37

Msi: "msi";

Windows MSI

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L35

Nsis: "nsis";

Windows NSIS

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L33

Rpm: "rpm";

Linux RPM

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L39

type DataStoreIdentifier: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L9

function defaultWindowIcon(): Promise<Image | null>

Get the default window icon.

Promise<Image | null>

import { defaultWindowIcon } from '@tauri-apps/api/app';
await defaultWindowIcon();

2.0.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L192


function fetchDataStoreIdentifiers(): Promise<DataStoreIdentifier[]>

Fetches the data store identifiers on macOS and iOS.

See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.

Promise<DataStoreIdentifier[]>

import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app';
const ids = await fetchDataStoreIdentifiers();

2.4.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L154


function getBundleType(): Promise<BundleType>

Promise<BundleType>

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L227


function getIdentifier(): Promise<string>

Gets the application identifier.

Promise<string>

The application identifier as configured in tauri.conf.json.

import { getIdentifier } from '@tauri-apps/api/app';
const identifier = await getIdentifier();

2.4.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L107


function getName(): Promise<string>

Gets the application name.

Promise<string>

import { getName } from '@tauri-apps/api/app';
const appName = await getName();

1.0.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L76


function getTauriVersion(): Promise<string>

Gets the Tauri version.

Promise<string>

import { getTauriVersion } from '@tauri-apps/api/app';
const tauriVersion = await getTauriVersion();

1.0.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L91


function getVersion(): Promise<string>

Gets the application version.

Promise<string>

import { getVersion } from '@tauri-apps/api/app';
const appVersion = await getVersion();

1.0.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L62


function hide(): Promise<void>

Hides the application on macOS.

Promise<void>

import { hide } from '@tauri-apps/api/app';
await hide();

1.2.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L137


function removeDataStore(uuid): Promise<DataStoreIdentifier[]>

Removes the data store with the given identifier.

Note that any webview using this data store should be closed before running this API.

See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.

ParameterType
uuidDataStoreIdentifier

Promise<DataStoreIdentifier[]>

import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app';
for (const id of (await fetchDataStoreIdentifiers())) {
await removeDataStore(id);
}

2.4.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L175


function setDockVisibility(visible): Promise<void>

Sets the dock visibility for the application on macOS.

ParameterTypeDescription
visiblebooleanwhether the dock should be visible or not

Promise<void>

2.5.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L223


function setTheme(theme?): Promise<void>

Set app’s theme, pass in null or undefined to follow system theme

ParameterType
theme?null | Theme

Promise<void>

import { setTheme } from '@tauri-apps/api/app';
await setTheme('dark');
  • iOS / Android: Unsupported.

2.0.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L213


function show(): Promise<void>

Shows the application on macOS. This function does not automatically focus any specific app window.

Promise<void>

import { show } from '@tauri-apps/api/app';
await show();

1.2.0

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L122


© 2025 Tauri Contributors. CC-BY / MIT