Skip to content
Tauri 中文网

app

Bundle type of the current application.

App: "app";

macOS app bundle

Source: undefined

AppImage: "appimage";

Linux AppImage

Source: undefined

Deb: "deb";

Linux Debian package

Source: undefined

Msi: "msi";

Windows MSI

Source: undefined

Nsis: "nsis";

Windows NSIS

Source: undefined

Rpm: "rpm";

Linux RPM

Source: undefined

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

Identifier type used for data stores on macOS and iOS.

Represents a 128-bit identifier, commonly expressed as a 16-byte UUID.

Source: undefined

function defaultWindowIcon(): Promise<Image | null>

Gets the default window icon.

Promise<Image | null>

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

2.0.0

Source: undefined


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: undefined


function getBundleType(): Promise<BundleType>

Gets the application bundle type.

Promise<BundleType>

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

2.5.0

Source: undefined


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: undefined


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: undefined


function getTauriVersion(): Promise<string>

Gets the Tauri framework version used by this application.

Promise<string>

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

1.0.0

Source: undefined


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: undefined


function hide(): Promise<void>

Hides the application on macOS.

Promise<void>

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

1.2.0

Source: undefined


function removeDataStore(uuid): Promise<void>

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<void>

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

2.4.0

Source: undefined


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>

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

2.5.0

Source: undefined


function setTheme(theme?): Promise<void>

Sets the application’s theme. Pass in null or undefined to follow the system theme.

ParameterType
theme?null | Theme

Promise<void>

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

Platform-specific

  • iOS / Android: Unsupported.

2.0.0

Source: undefined


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: undefined


Tauri v2.8 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站