The Tauri API allows you to interface with the backend layer.
This module exposes all other modules as an object where the key is the module name, and the value is the module exports.
import { event, window, path } from '@tauri-apps/api' Copy
import { event, window, path } from '@tauri-apps/api'
The above import syntax is for JavaScript/TypeScript with a bundler. If you're using vanilla JavaScript, you can use the global window.__TAURI__ object instead. It requires app.withGlobalTauri configuration option enabled.
window.__TAURI__
app.withGlobalTauri
const { event, window: tauriWindow, path } = window.__TAURI__; Copy
const { event, window: tauriWindow, path } = window.__TAURI__;
The Tauri API allows you to interface with the backend layer.
This module exposes all other modules as an object where the key is the module name, and the value is the module exports.
Example
Vanilla JS API
The above import syntax is for JavaScript/TypeScript with a bundler. If you're using vanilla JavaScript, you can use the global
window.__TAURI__
object instead. It requiresapp.withGlobalTauri
configuration option enabled.Example