From 3423f4e17eb9609536213de080dfb74dda4113ad Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 8 Jun 2023 12:58:44 -0300 Subject: [PATCH 01/90] refactor(core): use custom protocol for the IPC --- core/tauri-runtime-wry/Cargo.toml | 3 +- core/tauri-runtime-wry/src/lib.rs | 38 +---- core/tauri-runtime/src/webview.rs | 5 +- core/tauri-runtime/src/window.rs | 7 +- core/tauri-utils/src/pattern/isolation.js | 16 +- core/tauri-utils/src/pattern/isolation.rs | 18 +-- core/tauri/Cargo.toml | 1 - core/tauri/scripts/bundle.global.js | 2 +- core/tauri/scripts/core.js | 15 +- core/tauri/scripts/ipc-post-message.js | 20 +++ core/tauri/scripts/ipc.js | 4 +- core/tauri/scripts/process-ipc-message-fn.js | 29 ++++ .../tauri/scripts/stringify-ipc-message-fn.js | 17 --- core/tauri/src/app.rs | 20 ++- core/tauri/src/command.rs | 40 +++-- core/tauri/src/hooks.rs | 20 ++- core/tauri/src/manager.rs | 141 +++++++++++++----- core/tauri/src/window.rs | 62 +++++--- tooling/api/docs/js-api.json | 2 +- tooling/api/src/mocks.ts | 12 +- tooling/api/src/tauri.ts | 5 +- 21 files changed, 291 insertions(+), 186 deletions(-) create mode 100644 core/tauri/scripts/ipc-post-message.js create mode 100644 core/tauri/scripts/process-ipc-message-fn.js delete mode 100644 core/tauri/scripts/stringify-ipc-message-fn.js diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 736479fc84b5..63815c9ad758 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { version = "0.28.3", default-features = false, features = [ "file-drop", "protocol" ] } +wry = { version = "0.28.3", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } @@ -50,4 +50,3 @@ macos-private-api = [ "tauri-runtime/macos-private-api" ] objc-exception = [ "wry/objc-exception" ] -linux-headers = [ "wry/linux-headers", "webkit2gtk/v2_36" ] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 694d7ebe48e7..6a964e1d9f2b 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -7,9 +7,9 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle}; use tauri_runtime::{ http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse}, - menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate}, + menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuItem, MenuUpdate}, monitor::Monitor, - webview::{WebviewIpcHandler, WindowBuilder, WindowBuilderBase}, + webview::{WindowBuilder, WindowBuilderBase}, window::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, PendingWindow, WindowEvent, @@ -105,7 +105,6 @@ use std::{ }; pub type WebviewId = u64; -type IpcHandler = dyn Fn(&Window, String) + 'static; type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static; #[cfg(all(desktop, feature = "system-tray"))] pub use tauri_runtime::TrayId; @@ -3001,10 +3000,8 @@ fn create_webview( webview_attributes, uri_scheme_protocols, mut window_builder, - ipc_handler, label, url, - menu_ids, #[cfg(target_os = "android")] on_webview_created, .. @@ -3084,14 +3081,6 @@ fn create_webview( }); } - if let Some(handler) = ipc_handler { - webview_builder = webview_builder.with_ipc_handler(create_ipc_handler( - context, - label.clone(), - menu_ids, - handler, - )); - } for (scheme, protocol) in uri_scheme_protocols { webview_builder = webview_builder.with_custom_protocol(scheme, move |wry_request| { protocol(&HttpRequestWrapper::from(wry_request).0) @@ -3210,29 +3199,6 @@ fn create_webview( }) } -/// Create a wry ipc handler from a tauri ipc handler. -fn create_ipc_handler( - context: Context, - label: String, - menu_ids: Arc>>, - handler: WebviewIpcHandler>, -) -> Box { - Box::new(move |window, request| { - let window_id = context.webview_id_map.get(&window.id()).unwrap(); - handler( - DetachedWindow { - dispatcher: WryDispatcher { - window_id, - context: context.clone(), - }, - label: label.clone(), - menu_ids: menu_ids.clone(), - }, - request, - ); - }) -} - /// Create a wry file drop handler. fn create_file_drop_handler(window_event_listeners: WindowEventListeners) -> Box { Box::new(move |_window, event| { diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 888c127f5806..e9dd69b66c5a 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,7 +4,7 @@ //! Items specific to the [`Runtime`](crate::Runtime)'s webview. -use crate::{menu::Menu, window::DetachedWindow, Icon}; +use crate::{menu::Menu, Icon}; #[cfg(target_os = "macos")] use tauri_utils::TitleBarStyle; @@ -331,6 +331,3 @@ pub trait WindowBuilder: WindowBuilderBase { /// Gets the window menu. fn get_menu(&self) -> Option<&Menu>; } - -/// IPC handler. -pub type WebviewIpcHandler = Box, String) + Send>; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index fbb7899f9b92..c9522e1f0fd8 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -7,7 +7,7 @@ use crate::{ http::{Request as HttpRequest, Response as HttpResponse}, menu::{Menu, MenuEntry, MenuHash, MenuId}, - webview::{WebviewAttributes, WebviewIpcHandler}, + webview::WebviewAttributes, Dispatch, Runtime, UserEvent, WindowBuilder, }; use serde::{Deserialize, Deserializer, Serialize}; @@ -226,9 +226,6 @@ pub struct PendingWindow> { pub uri_scheme_protocols: HashMap>, - /// How to handle IPC calls on the webview window. - pub ipc_handler: Option>, - /// Maps runtime id to a string menu id. pub menu_ids: Arc>>, @@ -279,7 +276,6 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, - ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), @@ -311,7 +307,6 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, - ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index ce284d59a1da..1559d0b82231 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -38,17 +38,17 @@ * @return {Promise<{nonce: number[], payload: number[]}>} */ async function encrypt(data) { - let algorithm = Object.create(null) + const algorithm = Object.create(null) algorithm.name = 'AES-GCM' algorithm.iv = window.crypto.getRandomValues(new Uint8Array(12)) - let encoder = new TextEncoder() - let payloadRaw = encoder.encode(__RAW_stringify_ipc_message_fn__(data)) + const encoder = new TextEncoder() + const encoded = encoder.encode(__RAW_process_ipc_message_fn__(data).data) return window.crypto.subtle - .encrypt(algorithm, aesGcmKey, payloadRaw) + .encrypt(algorithm, aesGcmKey, encoded) .then((payload) => { - let result = Object.create(null) + const result = Object.create(null) result.nonce = Array.from(new Uint8Array(algorithm.iv)) result.payload = Array.from(new Uint8Array(payload)) return result @@ -85,8 +85,10 @@ data = await window.__TAURI_ISOLATION_HOOK__(data) } - const encrypted = await encrypt(data) - sendMessage(encrypted) + const { cmd, callback, error, payload } = data + + const encrypted = await encrypt(payload) + sendMessage({ cmd, callback, error, payload: encrypted }) } window.addEventListener('message', payloadHandler, false) diff --git a/core/tauri-utils/src/pattern/isolation.rs b/core/tauri-utils/src/pattern/isolation.rs index ae5382450320..3b2dfc0846ce 100644 --- a/core/tauri-utils/src/pattern/isolation.rs +++ b/core/tauri-utils/src/pattern/isolation.rs @@ -96,16 +96,14 @@ impl Keys { } /// Decrypts a message using the generated keys. - pub fn decrypt(&self, raw: RawIsolationPayload<'_>) -> Result { + pub fn decrypt(&self, raw: RawIsolationPayload<'_>) -> Result, Error> { let RawIsolationPayload { nonce, payload } = raw; let nonce: [u8; 12] = nonce.as_ref().try_into()?; - let bytes = self + self .aes_gcm .key .decrypt(Nonce::from_slice(&nonce), payload.as_ref()) - .map_err(|_| self::Error::Aes)?; - - String::from_utf8(bytes).map_err(Into::into) + .map_err(|_| self::Error::Aes) } } @@ -116,11 +114,11 @@ pub struct RawIsolationPayload<'a> { payload: Cow<'a, [u8]>, } -impl<'a> TryFrom<&'a str> for RawIsolationPayload<'a> { +impl<'a> TryFrom<&'a Vec> for RawIsolationPayload<'a> { type Error = Error; - fn try_from(value: &'a str) -> Result { - serde_json::from_str(value).map_err(Into::into) + fn try_from(value: &'a Vec) -> Result { + serde_json::from_slice(value).map_err(Into::into) } } @@ -141,9 +139,9 @@ pub struct IsolationJavascriptCodegen { pub struct IsolationJavascriptRuntime<'a> { /// The key used on the Rust backend and the Isolation Javascript pub runtime_aes_gcm_key: &'a [u8; 32], - /// The function that stringifies a IPC message. + /// The function that processes the IPC message. #[raw] - pub stringify_ipc_message_fn: &'a str, + pub process_ipc_message_fn: &'a str, } #[cfg(test)] diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 3145ce8fa5d2..9e16251409eb 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -120,7 +120,6 @@ default = [ "wry", "compression", "objc-exception" ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = [ "tauri-runtime-wry" ] objc-exception = [ "tauri-runtime-wry/objc-exception" ] -linux-protocol-headers = [ "tauri-runtime-wry/linux-headers", "webkit2gtk/v2_36" ] isolation = [ "tauri-utils/isolation", "tauri-macros/isolation" ] custom-protocol = [ "tauri-macros/custom-protocol" ] native-tls = [ "reqwest/native-tls" ] diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 3ae27b270d74..9c72692d0cfb 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var p=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},W=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(P(n,e,"read from private field"),i?i.call(n):e.get(n)),D=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},w=(n,e,i,o)=>(P(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var hn={};p(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};p(f,{TauriEvent:()=>b,emit:()=>F,listen:()=>I,once:()=>U});var y={};p(y,{Channel:()=>l,PluginListener:()=>g,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,l=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){w(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var g=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new l;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new g(n,e,o.id))}async function t(n,e={}){return new Promise((i,o)=>{let a=u(d=>{i(d),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(d=>{o(d),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,...e})})}function k(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function A(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function I(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>A(n,o))}async function U(n,e,i){return I(n,o=>{e(o),A(n,o.id).catch(()=>{})},i)}async function F(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};p(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>M,basename:()=>_n,cacheDir:()=>V,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>dn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>gn,localDataDir:()=>Z,normalize:()=>ln,pictureDir:()=>X,publicDir:()=>B,resolve:()=>pn,resolveResource:()=>en,resourceDir:()=>nn,runtimeDir:()=>rn,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function V(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function rn(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function pn(...n){return t("plugin:path|resolve",{paths:n})}async function ln(n){return t("plugin:path|normalize",{path:n})}async function gn(...n){return t("plugin:path|join",{paths:n})}async function dn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},W=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(P(n,e,"read from private field"),i?i.call(n):e.get(n)),D=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},w=(n,e,i,o)=>(P(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>b,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){w(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:e})})}function k(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function A(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function I(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>A(n,o))}async function U(n,e,i){return I(n,o=>{e(o),A(n,o.id).catch(()=>{})},i)}async function F(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>nn,runtimeDir:()=>rn,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function rn(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 9af28ee1b610..160e43637620 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -48,7 +48,7 @@ } } - window.__TAURI_INVOKE__ = function invoke(cmd, args = {}) { + window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}) { return new Promise(function (resolve, reject) { var callback = window.__TAURI__.transformCallback(function (r) { resolve(r) @@ -59,19 +59,12 @@ delete window[`_${callback}`] }, true) - if (typeof cmd === 'string') { - args.cmd = cmd - } else if (typeof cmd === 'object') { - args = cmd - } else { - return reject(new Error('Invalid argument type.')) - } - const action = () => { window.__TAURI_IPC__({ - ...args, + cmd, callback, - error: error + error, + payload }) } if (window.__TAURI_IPC__) { diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js new file mode 100644 index 000000000000..459256005fe0 --- /dev/null +++ b/core/tauri/scripts/ipc-post-message.js @@ -0,0 +1,20 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +(function () { +Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { + value: (message) => { + const { cmd, callback, error, payload } = message + const { contentType, data } = __RAW_process_ipc_message_fn__(payload) + fetch(`ipc://localhost/${cmd}`, { + method: 'POST', + body: data, + headers: { + 'Content-Type': contentType, + 'Tauri-Callback': callback, + 'Tauri-Error': error, + } + }) + }}) +})() diff --git a/core/tauri/scripts/ipc.js b/core/tauri/scripts/ipc.js index 83ba1121d287..d3bedb5151a6 100644 --- a/core/tauri/scripts/ipc.js +++ b/core/tauri/scripts/ipc.js @@ -35,8 +35,8 @@ function isIsolationMessage(event) { return ( typeof event.data === 'object' && - 'nonce' in event.data && - 'payload' in event.data + 'nonce' in event.data.payload && + 'payload' in event.data.payload ) } diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js new file mode 100644 index 000000000000..4474cd38c9e3 --- /dev/null +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -0,0 +1,29 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +(function (message) { + if (message instanceof ArrayBuffer || Array.isArray(message)) { + return { + contentType: 'application/octet-stream', + data: message + } + } else { + const data = JSON.stringify(message, (_k, val) => { + if (val instanceof Map) { + let o = {}; + val.forEach((v, k) => o[k] = v); + return o; + } else if (val instanceof Object && '__TAURI_CHANNEL_MARKER__' in val && typeof val.id === 'number') { + return `__CHANNEL__:${val.id}` + } else { + return val; + } + }) + + return { + contentType: 'application/json', + data + } + } +}) diff --git a/core/tauri/scripts/stringify-ipc-message-fn.js b/core/tauri/scripts/stringify-ipc-message-fn.js deleted file mode 100644 index 5330a1358815..000000000000 --- a/core/tauri/scripts/stringify-ipc-message-fn.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -(function (message) { - return JSON.stringify(message, (_k, val) => { - if (val instanceof Map) { - let o = {}; - val.forEach((v, k) => o[k] = v); - return o; - } else if (val instanceof Object && '__TAURI_CHANNEL_MARKER__' in val && typeof val.id === 'number') { - return `__CHANNEL__:${val.id}` - } else { - return val; - } - }) -}) diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index a277246c363d..f42af70d3447 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -23,6 +23,7 @@ use crate::{ sealed::{ManagerBase, RuntimeOrDispatch}, utils::config::Config, utils::{assets::Assets, Env}, + window::IpcStore, Context, DeviceEventFilter, EventLoopMessage, Icon, Invoke, InvokeError, InvokeResponse, Manager, Runtime, Scopes, StateManager, Theme, Window, }; @@ -31,6 +32,7 @@ use crate::{ use crate::scope::FsScope; use raw_window_handle::HasRawDisplayHandle; +use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use tauri_macros::default_runtime; use tauri_runtime::window::{ dpi::{PhysicalPosition, PhysicalSize}, @@ -812,6 +814,14 @@ pub struct Builder { device_event_filter: DeviceEventFilter, } +#[derive(Template)] +#[default_template("../scripts/ipc-post-message.js")] +struct InvokeInitializationScript<'a> { + /// The function that processes the IPC message. + #[raw] + process_ipc_message_fn: &'a str, +} + impl Builder { /// Creates a new App builder. pub fn new() -> Self { @@ -821,8 +831,12 @@ impl Builder { setup: Box::new(|_| Ok(())), invoke_handler: Box::new(|_| false), invoke_responder: Arc::new(window_invoke_responder), - invoke_initialization_script: - format!("Object.defineProperty(window, '__TAURI_POST_MESSAGE__', {{ value: (message) => window.ipc.postMessage({}(message)) }})", crate::manager::STRINGIFY_IPC_MESSAGE_FN), + invoke_initialization_script: InvokeInitializationScript { + process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, + } + .render_default(&Default::default()) + .unwrap() + .into_string(), on_page_load: Box::new(|_, _| ()), pending_windows: Default::default(), plugins: PluginStore::default(), @@ -1332,6 +1346,8 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); + app.manage(IpcStore::default()); + #[cfg(windows)] { if let crate::utils::config::WebviewInstallMode::FixedRuntime { path } = &app diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index 7f392d480826..ebb1a9cfcb7f 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -7,11 +7,13 @@ //! You usually don't need to create these items yourself. These are created from [command](../attr.command.html) //! attribute macro along the way and used by [`crate::generate_handler`] macro. -use crate::hooks::InvokeError; +use crate::hooks::{InvokeError, InvokePayloadValue}; use crate::InvokeMessage; use crate::Runtime; -use serde::de::Visitor; -use serde::{Deserialize, Deserializer}; +use serde::{ + de::{Error, Visitor}, + Deserialize, Deserializer, +}; /// Represents a custom command. pub struct CommandItem<'a, R: Runtime> { @@ -62,8 +64,6 @@ impl<'de, D: Deserialize<'de>, R: Runtime> CommandArg<'de, R> for D { macro_rules! pass { ($fn:ident, $($arg:ident: $argt:ty),+) => { fn $fn>(self, $($arg: $argt),*) -> Result { - use serde::de::Error; - if self.key.is_empty() { return Err(serde_json::Error::custom(format!( "command {} has an argument with no name with a non-optional value", @@ -71,14 +71,24 @@ macro_rules! pass { ))) } - match self.message.payload.get(self.key) { - Some(value) => value.$fn($($arg),*), - None => { + match &self.message.payload { + InvokePayloadValue::Raw(_body) => { Err(serde_json::Error::custom(format!( - "command {} missing required key {}", + "command {} expected a value for key {} but the IPC call used a bytes payload", self.name, self.key ))) } + InvokePayloadValue::Json(v) => { + match v.get(self.key) { + Some(value) => value.$fn($($arg),*), + None => { + Err(serde_json::Error::custom(format!( + "command {} missing required key {}", + self.name, self.key + ))) + } + } + } } } } @@ -111,9 +121,15 @@ impl<'de, R: Runtime> Deserializer<'de> for CommandItem<'de, R> { pass!(deserialize_byte_buf, visitor: V); fn deserialize_option>(self, visitor: V) -> Result { - match self.message.payload.get(self.key) { - Some(value) => value.deserialize_option(visitor), - None => visitor.visit_none(), + match &self.message.payload { + InvokePayloadValue::Raw(_body) => Err(serde_json::Error::custom(format!( + "command {} expected a value for key {} but the IPC call used a bytes payload", + self.name, self.key + ))), + InvokePayloadValue::Json(v) => match v.get(self.key) { + Some(value) => value.deserialize_option(visitor), + None => visitor.visit_none(), + }, } } diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index 4bbe77f0a9d6..67c671ece024 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -56,8 +56,17 @@ impl PageLoadPayload { } } +/// Possible values of an IPC payload. +#[derive(Debug, Clone)] +pub enum InvokePayloadValue { + /// Json payload. + Json(JsonValue), + /// Bytes payload. + Raw(Vec), +} + /// The payload used on the IPC invoke. -#[derive(Debug, Deserialize)] +#[derive(Debug)] pub struct InvokePayload { /// The invoke command. pub cmd: String, @@ -66,8 +75,7 @@ pub struct InvokePayload { /// The error callback. pub error: CallbackFn, /// The payload of the message. - #[serde(flatten)] - pub inner: JsonValue, + pub inner: InvokePayloadValue, } /// The message and resolver given to a custom command. @@ -296,7 +304,7 @@ pub struct InvokeMessage { /// The IPC command. pub(crate) command: String, /// The JSON argument passed on the invoke message. - pub(crate) payload: JsonValue, + pub(crate) payload: InvokePayloadValue, } impl Clone for InvokeMessage { @@ -316,7 +324,7 @@ impl InvokeMessage { window: Window, state: Arc, command: String, - payload: JsonValue, + payload: InvokePayloadValue, ) -> Self { Self { window, @@ -346,7 +354,7 @@ impl InvokeMessage { /// A reference to the payload the invoke received. #[inline(always)] - pub fn payload(&self) -> &JsonValue { + pub fn payload(&self) -> &InvokePayloadValue { &self.payload } diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index b7409b5c972b..e9c376613f8a 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -11,7 +11,6 @@ use std::{ }; use serde::Serialize; -use serde_json::Value as JsonValue; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use url::Url; @@ -25,11 +24,10 @@ use tauri_utils::{ html::{SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN}, }; -use crate::app::{GlobalMenuEventListener, WindowMenuEvent}; -use crate::hooks::IpcJavascript; #[cfg(feature = "isolation")] use crate::hooks::IsolationJavascript; use crate::pattern::PatternJavascript; +use crate::{api::ipc::CallbackFn, hooks::IpcJavascript}; use crate::{ app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, @@ -40,7 +38,7 @@ use crate::{ MimeType, Request as HttpRequest, Response as HttpResponse, ResponseBuilder as HttpResponseBuilder, }, - webview::{WebviewIpcHandler, WindowBuilder}, + webview::WindowBuilder, window::{dpi::PhysicalSize, DetachedWindow, FileDropEvent, PendingWindow}, }, utils::{ @@ -51,6 +49,10 @@ use crate::{ Context, EventLoopMessage, Icon, Invoke, Manager, Pattern, Runtime, Scopes, StateManager, Window, WindowEvent, }; +use crate::{ + app::{GlobalMenuEventListener, WindowMenuEvent}, + hooks::InvokePayloadValue, +}; #[cfg(any(target_os = "linux", target_os = "windows"))] use crate::path::BaseDirectory; @@ -70,8 +72,8 @@ const WINDOW_FILE_DROP_HOVER_EVENT: &str = "tauri://file-drop-hover"; const WINDOW_FILE_DROP_CANCELLED_EVENT: &str = "tauri://file-drop-cancelled"; const MENU_EVENT: &str = "tauri://menu"; -pub(crate) const STRINGIFY_IPC_MESSAGE_FN: &str = - include_str!("../scripts/stringify-ipc-message-fn.js"); +pub(crate) const PROCESS_IPC_MESSAGE_FN: &str = + include_str!("../scripts/process-ipc-message-fn.js"); // we need to proxy the dev server on mobile because we can't use `localhost`, so we use the local IP address // and we do not get a secure context without the custom protocol that proxies to the dev server @@ -502,6 +504,14 @@ impl WindowManager { registered_scheme_protocols.push("tauri".into()); } + if !registered_scheme_protocols.contains(&"ipc".into()) { + pending.register_uri_scheme_protocol( + "ipc", + self.prepare_ipc_scheme_protocol(pending.label.clone()), + ); + registered_scheme_protocols.push("ipc".into()); + } + #[cfg(feature = "protocol-asset")] if !registered_scheme_protocols.contains(&"asset".into()) { let asset_scope = self.state().get::().asset_protocol.clone(); @@ -534,7 +544,7 @@ impl WindowManager { let asset = String::from_utf8_lossy(asset.as_ref()); let template = tauri_utils::pattern::isolation::IsolationJavascriptRuntime { runtime_aes_gcm_key: &aes_gcm_key, - stringify_ipc_message_fn: STRINGIFY_IPC_MESSAGE_FN, + process_ipc_message_fn: PROCESS_IPC_MESSAGE_FN, }; match template.render(asset.as_ref(), &Default::default()) { Ok(asset) => HttpResponseBuilder::new() @@ -563,40 +573,15 @@ impl WindowManager { Ok(pending) } - fn prepare_ipc_handler(&self) -> WebviewIpcHandler { + fn prepare_ipc_scheme_protocol( + &self, + label: String, + ) -> Box Result> + Send + Sync> + { let manager = self.clone(); - Box::new(move |window, #[allow(unused_mut)] mut request| { - if let Some(window) = manager.get_window(&window.label) { - #[cfg(feature = "isolation")] - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - match RawIsolationPayload::try_from(request.as_str()) - .and_then(|raw| crypto_keys.decrypt(raw)) - { - Ok(json) => request = json, - Err(e) => { - let error: crate::Error = e.into(); - let _ = window.eval(&format!( - r#"console.error({})"#, - JsonValue::String(error.to_string()) - )); - return; - } - } - } - - match serde_json::from_str::(&request) { - Ok(message) => { - let _ = window.on_message(message); - } - Err(e) => { - let error: crate::Error = e.into(); - let _ = window.eval(&format!( - r#"console.error({})"#, - JsonValue::String(error.to_string()) - )); - } - } - } + Box::new(move |request| { + let data = handle_ipc_request(request, &manager, &label)?; + Ok(HttpResponse::new(data.into())) }) } @@ -1082,7 +1067,6 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; - pending.ipc_handler = Some(self.prepare_ipc_handler()); // in `Windows`, we need to force a data_directory // but we do respect user-specification @@ -1419,6 +1403,81 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } +fn handle_ipc_request( + request: &HttpRequest, + manager: &WindowManager, + label: &str, +) -> std::result::Result, String> { + if let Some(window) = manager.get_window(&label) { + // TODO: consume instead + let mut body = request.body().clone(); + + let cmd = request + .uri() + .strip_prefix("ipc://localhost") + .map(|c| c.to_string()) + // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows + // where `$P` is not `localhost/*` + // in this case the IPC call is considered invalid + .unwrap_or_else(|| "".to_string()); + + #[cfg(feature = "isolation")] + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + match RawIsolationPayload::try_from(&body).and_then(|raw| crypto_keys.decrypt(raw)) { + Ok(data) => body = data, + Err(e) => { + return Err(e.to_string()); + } + } + } + + let callback = CallbackFn( + request + .headers() + .get("Tauri-Callback") + .ok_or("missing Tauri-Callback header")? + .to_str() + .map_err(|_| "Tauri-Callback header value must be a string")? + .parse() + .map_err(|_| "Tauri-Callback header value must be a numeric string")?, + ); + let error = CallbackFn( + request + .headers() + .get("Tauri-Error") + .ok_or("missing Tauri-Error header")? + .to_str() + .map_err(|_| "Tauri-Error header value must be a string")? + .parse() + .map_err(|_| "Tauri-Error header value must be a numeric string")?, + ); + + let content_type = request + .headers() + .get(reqwest::header::CONTENT_TYPE) + .and_then(|h| h.to_str().ok()) + .unwrap_or("application/octet-stream"); + let data = match content_type { + "application/octet-stream" => InvokePayloadValue::Raw(body), + "application/json" => { + InvokePayloadValue::Json(serde_json::from_slice(&body).map_err(|e| e.to_string())?) + } + _ => return Err(format!("unknown content type {content_type}")), + }; + + let payload = InvokePayload { + cmd, + callback, + error, + inner: data, + }; + + window.on_message(payload).map_err(|e| e.to_string()) + } else { + Err("window not found".into()) + } +} + #[cfg(test)] mod tests { use super::replace_with_callback; diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 383d6f329b35..345c750735cf 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -17,7 +17,7 @@ use crate::{ app::AppHandle, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, - hooks::{InvokePayload, InvokeResponder}, + hooks::{InvokePayload, InvokePayloadValue, InvokeResponder}, manager::WindowManager, runtime::{ http::{Request as HttpRequest, Response as HttpResponse}, @@ -56,12 +56,31 @@ use std::{ fmt, hash::{Hash, Hasher}, path::PathBuf, - sync::{Arc, Mutex}, + sync::{ + mpsc::{channel, Sender}, + Arc, Mutex, + }, }; pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; pub(crate) type NavigationHandler = dyn Fn(Url) -> bool + Send; +#[derive(Eq, PartialEq)] +pub(crate) struct IpcKey { + callback: CallbackFn, + error: CallbackFn, +} + +impl Hash for IpcKey { + fn hash(&self, state: &mut H) { + self.callback.hash(state); + self.error.hash(state); + } +} + +#[derive(Default)] +pub(crate) struct IpcStore(Mutex>>>); + #[derive(Clone, Serialize)] struct WindowCreatedEvent { label: String, @@ -1653,8 +1672,8 @@ impl Window { self.current_url = url; } - /// Handles this window receiving an [`InvokeMessage`]. - pub fn on_message(self, payload: InvokePayload) -> crate::Result<()> { + /// Handles this window receiving an [`InvokeMessage`] and returns the response. + pub fn on_message(self, payload: InvokePayload) -> Result, String> { let manager = self.manager.clone(); let current_url = self.url(); let config_url = manager.get_url(); @@ -1680,8 +1699,12 @@ impl Window { }; match payload.cmd.as_str() { "__initialized" => { - let payload: PageLoadPayload = serde_json::from_value(payload.inner)?; + let payload: PageLoadPayload = match payload.inner { + InvokePayloadValue::Json(v) => serde_json::from_value(v).map_err(|e| e.to_string())?, + InvokePayloadValue::Raw(v) => serde_json::from_slice(&v).map_err(|e| e.to_string())?, + }; manager.run_on_page_load(self, payload); + Ok(Vec::new()) } _ => { let message = InvokeMessage::new( @@ -1690,13 +1713,21 @@ impl Window { payload.cmd.to_string(), payload.inner, ); - #[allow(clippy::redundant_clone)] let resolver = InvokeResolver::new(self.clone(), payload.callback, payload.error); let mut invoke = Invoke { message, resolver }; + + let (tx, rx) = channel(); + self.state::().0.lock().unwrap().insert( + IpcKey { + callback: payload.callback, + error: payload.error, + }, + tx, + ); + if !is_local && scope.is_none() { - invoke.resolver.reject(scope_not_found_error_message); - return Ok(()); + return Err(scope_not_found_error_message); } if payload.cmd.starts_with("plugin:") { @@ -1707,8 +1738,7 @@ impl Window { .map(|s| s.plugins().contains(&plugin_name)) .unwrap_or(true) { - invoke.resolver.reject(IPC_SCOPE_DOES_NOT_ALLOW); - return Ok(()); + return Err(IPC_SCOPE_DOES_NOT_ALLOW.into()); } } let command = invoke.message.command.replace("plugin:", ""); @@ -1721,9 +1751,8 @@ impl Window { .unwrap_or_else(String::new); let command = invoke.message.command.clone(); - let resolver = invoke.resolver.clone(); #[cfg(mobile)] - let message = invoke.message.clone(); + let (resolver, message) = (invoke.resolver.clone(), invoke.message.clone()); #[allow(unused_mut)] let mut handled = manager.extend_api(plugin, invoke); @@ -1819,20 +1848,19 @@ impl Window { } if !handled { - resolver.reject(format!("Command {command} not found")); + return Err(format!("Command {command} not found")); } } else { let command = invoke.message.command.clone(); - let resolver = invoke.resolver.clone(); let handled = manager.run_invoke_handler(invoke); if !handled { - resolver.reject(format!("Command {command} not found")); + return Err(format!("Command {command} not found")); } } + + Ok(rx.recv().unwrap()) } } - - Ok(()) } /// Evaluates JavaScript on this window. diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index e734e99a7719..94f1826a0834 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L163"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L163"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L98"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L98"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L136"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L136"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n switch (cmd) {\n case \"add\":\n return (args.a as number) + (args.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"args","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":73,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":74,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":66,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L66"}],"signatures":[{"id":75,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":66,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L66"}],"typeParameter":[{"id":76,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":73,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":79,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":62,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L62"}],"type":{"type":"reflection","declaration":{"id":80,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":62,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L62"}],"signatures":[{"id":81,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":62,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L62"}],"parameters":[{"id":82,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":78,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":61,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L61"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":77,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L59"}],"type":{"type":"intrinsic","name":"number"}},{"id":83,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L72"},{"fileName":"tauri.ts","line":76,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L76"}],"getSignature":{"id":84,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L76"}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L76"}],"signatures":[{"id":86,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L76"}],"parameters":[{"id":87,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":88,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L72"}],"parameters":[{"id":89,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":90,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L72"}],"signatures":[{"id":91,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L72"}],"parameters":[{"id":92,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":93,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":80,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L80"}],"signatures":[{"id":94,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":80,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L80"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[74]},{"title":"Properties","children":[79,78,77]},{"title":"Accessors","children":[83]},{"title":"Methods","children":[93]}],"sources":[{"fileName":"tauri.ts","line":58,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L58"}],"typeParameters":[{"id":95,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":96,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":97,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":90,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L90"}],"signatures":[{"id":98,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":90,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L90"}],"parameters":[{"id":99,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":100,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":101,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":104,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":88,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L88"}],"type":{"type":"intrinsic","name":"number"}},{"id":103,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L87"}],"type":{"type":"intrinsic","name":"string"}},{"id":102,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":86,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L86"}],"type":{"type":"intrinsic","name":"string"}},{"id":105,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":96,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L96"}],"signatures":[{"id":106,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":96,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L96"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[97]},{"title":"Properties","children":[104,103,102]},{"title":"Methods","children":[105]}],"sources":[{"fileName":"tauri.ts","line":85,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L85"}]},{"id":65,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":128,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L128"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":107,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":108,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":111,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L111"}],"typeParameter":[{"id":109,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":110,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":111,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":113,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":114,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L114"}],"signatures":[{"id":114,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":114,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L114"}],"parameters":[{"id":115,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":194,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L194"}],"signatures":[{"id":122,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":194,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L194"}],"parameters":[{"id":123,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":124,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":116,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":144,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L144"}],"signatures":[{"id":117,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":144,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L144"}],"typeParameter":[{"id":118,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":119,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":120,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":65,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":66,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":36,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L36"}],"signatures":[{"id":67,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":36,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L36"}],"parameters":[{"id":68,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":69,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":37,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L37"}],"signatures":[{"id":70,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":37,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L37"}],"parameters":[{"id":71,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":72,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[73,96]},{"title":"Type Aliases","children":[65]},{"title":"Functions","children":[107,121,116,66]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/fc889bc22/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"args"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"65":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"66":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"67":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"68":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"69":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"70":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"71":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"72":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"73":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"74":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"75":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"76":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"77":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"78":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"79":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"80":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"81":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"82":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"83":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"84":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"85":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"86":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"87":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"88":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"89":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"90":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"91":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"92":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"93":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"94":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"95":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"96":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"97":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"98":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"99":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"100":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"101":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"102":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"103":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"104":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"105":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"106":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"107":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"108":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"109":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"110":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"111":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"112":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"113":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"114":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"115":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"116":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"117":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"118":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"119":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"120":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"121":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"122":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"123":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"124":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L163"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L163"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L98"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L98"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L136"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L136"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n switch (cmd) {\n case \"add\":\n return (args.a as number) + (args.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"args","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":73,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":74,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":75,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":76,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":73,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":79,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":80,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":81,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":82,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":78,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":77,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":83,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":84,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":86,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":87,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":88,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":89,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":90,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":91,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":92,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":93,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":94,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[74]},{"title":"Properties","children":[79,78,77]},{"title":"Accessors","children":[83]},{"title":"Methods","children":[93]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":95,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":96,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":97,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":98,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":99,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":100,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":101,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":104,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":103,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":102,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":105,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":106,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[97]},{"title":"Properties","children":[104,103,102]},{"title":"Methods","children":[105]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L82"}]},{"id":65,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L125"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":107,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":108,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":109,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":110,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":111,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":113,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":114,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":115,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":122,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":123,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":124,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":116,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":117,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":118,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":119,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":120,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":65,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":66,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":67,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":68,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":69,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":70,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":71,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":72,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[73,96]},{"title":"Type Aliases","children":[65]},{"title":"Functions","children":[107,121,116,66]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"args"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"65":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"66":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"67":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"68":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"69":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"70":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"71":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"72":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"73":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"74":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"75":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"76":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"77":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"78":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"79":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"80":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"81":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"82":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"83":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"84":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"85":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"86":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"87":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"88":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"89":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"90":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"91":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"92":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"93":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"94":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"95":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"96":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"97":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"98":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"99":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"100":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"101":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"102":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"103":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"104":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"105":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"106":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"107":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"108":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"109":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"110":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"111":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"112":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"113":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"114":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"115":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"116":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"117":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"118":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"119":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"120":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"121":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"122":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"123":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"124":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/mocks.ts b/tooling/api/src/mocks.ts index 56b9ac81ce32..5de4fcfcc51b 100644 --- a/tooling/api/src/mocks.ts +++ b/tooling/api/src/mocks.ts @@ -41,10 +41,10 @@ interface IPCMessage { * }) * * test("mocked command", () => { - * mockIPC((cmd, args) => { + * mockIPC((cmd, payload) => { * switch (cmd) { * case "add": - * return (args.a as number) + (args.b as number); + * return (payload.a as number) + (payload.b as number); * default: * break; * } @@ -64,7 +64,7 @@ interface IPCMessage { * }) * * test("mocked command", () => { - * mockIPC((cmd, args) => { + * mockIPC((cmd, payload) => { * if(cmd === "get_data") { * return fetch("https://example.com/data.json") * .then((response) => response.json()) @@ -78,19 +78,19 @@ interface IPCMessage { * @since 1.0.0 */ export function mockIPC( - cb: (cmd: string, args: Record) => any | Promise + cb: (cmd: string, payload: Record) => any | Promise ): void { // eslint-disable-next-line @typescript-eslint/no-misused-promises window.__TAURI_IPC__ = async ({ cmd, callback, error, - ...args + payload }: IPCMessage) => { try { // @ts-expect-error The function key is dynamic and therefore not typed // eslint-disable-next-line @typescript-eslint/no-unsafe-call - window[`_${callback}`](await cb(cmd, args)) + window[`_${callback}`](await cb(cmd, payload)) } catch (err) { // @ts-expect-error The function key is dynamic and therefore not typed // eslint-disable-next-line @typescript-eslint/no-unsafe-call diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index d8ca1aa70e44..217536d905cb 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -14,9 +14,6 @@ declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Window { __TAURI_IPC__: (message: any) => void - ipc: { - postMessage: (args: string) => void - } } } @@ -156,7 +153,7 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { cmd, callback, error, - ...args + payload: args }) }) } From fef3bf37650daf59f57767f6bc969d3038ab5bf4 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 8 Jun 2023 14:28:52 -0300 Subject: [PATCH 02/90] fix isolation check, respond --- core/tauri-utils/src/pattern/isolation.js | 26 ++++++++-- core/tauri/scripts/ipc-post-message.js | 12 +++++ core/tauri/scripts/ipc.js | 11 +++-- core/tauri/src/hooks.rs | 59 ++++++++++++----------- core/tauri/src/manager.rs | 53 ++++++++++++++++---- core/tauri/src/window.rs | 19 ++++---- 6 files changed, 126 insertions(+), 54 deletions(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 1559d0b82231..93f955fa2ca5 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -55,17 +55,33 @@ }) } + /** + * Detects if a message event is a valid isolation message. + * + * @param {MessageEvent} event - a message event that is expected to be an isolation message + * @return {boolean} - if the event was a valid isolation message + */ + function isIsolationMessage(data) { + return ( + typeof data === 'object' && + typeof data.payload === 'object' && + Object.keys(data.payload).every((key) => key === 'nonce' || key === 'payload') + ) + } + /** * Detect if a message event is a valid isolation payload. * * @param {MessageEvent} event - a message event that is expected to be an isolation payload * @return boolean */ - function isIsolationPayload(event) { + function isIsolationPayload(data) { return ( - typeof event.data === 'object' && - 'callback' in event.data && - 'error' in event.data + typeof data === 'object' && + typeof data.payload === 'object' && + 'callback' in data && + 'error' in data && + !isIsolationMessage(data) ) } @@ -74,7 +90,7 @@ * @param {MessageEvent} event */ async function payloadHandler(event) { - if (!isIsolationPayload(event)) { + if (!isIsolationPayload(event.data)) { return } diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js index 459256005fe0..a113656ede43 100644 --- a/core/tauri/scripts/ipc-post-message.js +++ b/core/tauri/scripts/ipc-post-message.js @@ -15,6 +15,18 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { 'Tauri-Callback': callback, 'Tauri-Error': error, } + }).then((response) => { + const cb = response.ok ? callback : error + switch (response.headers.get('content-type')) { + case 'application/json': + return response.json().then((r) => [cb, r]) + case 'text/plain': + return response.text().then((r) => [cb, r]) + default: + return response.arrayBuffer().then((r) => [cb, r]) + } + }).then(([cb, data]) => { + window[`_${cb}`](data) }) }}) })() diff --git a/core/tauri/scripts/ipc.js b/core/tauri/scripts/ipc.js index d3bedb5151a6..6bd4a37eb94b 100644 --- a/core/tauri/scripts/ipc.js +++ b/core/tauri/scripts/ipc.js @@ -35,8 +35,8 @@ function isIsolationMessage(event) { return ( typeof event.data === 'object' && - 'nonce' in event.data.payload && - 'payload' in event.data.payload + typeof event.data.payload === 'object' && + Object.keys(event.data.payload).every((key) => key === 'nonce' || key === 'payload') ) } @@ -47,7 +47,12 @@ * @return {boolean} - if the data is able to transform into an isolation payload */ function isIsolationPayload(data) { - return typeof data === 'object' && 'callback' in data && 'error' in data + return ( + typeof data === 'object' && + 'callback' in data && + 'error' in data && + !isIsolationMessage(data) + ) } /** diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index 67c671ece024..f997832dc5ff 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -3,9 +3,10 @@ // SPDX-License-Identifier: MIT use crate::{ - api::ipc::{format_callback, format_callback_result, CallbackFn}, + api::ipc::CallbackFn, app::App, - Runtime, StateManager, Window, + window::{IpcKey, IpcStore}, + Manager, Runtime, StateManager, Window, }; use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; @@ -65,6 +66,18 @@ pub enum InvokePayloadValue { Raw(Vec), } +impl From for InvokePayloadValue { + fn from(value: JsonValue) -> Self { + Self::Json(value) + } +} + +impl From> for InvokePayloadValue { + fn from(value: Vec) -> Self { + Self::Raw(value) + } +} + /// The payload used on the IPC invoke. #[derive(Debug)] pub struct InvokePayload { @@ -91,7 +104,7 @@ pub struct Invoke { /// Error response from an [`InvokeMessage`]. #[derive(Debug)] -pub struct InvokeError(JsonValue); +pub struct InvokeError(pub JsonValue); impl InvokeError { /// Create an [`InvokeError`] as a string of the [`serde_json::Error`] message. @@ -119,7 +132,7 @@ impl From for InvokeError { impl From for InvokeError { #[inline(always)] fn from(error: crate::Error) -> Self { - Self(JsonValue::String(error.to_string())) + Self(JsonValue::String(error.to_string()).into()) } } @@ -127,28 +140,17 @@ impl From for InvokeError { #[derive(Debug)] pub enum InvokeResponse { /// Resolve the promise. - Ok(JsonValue), + Ok(InvokePayloadValue), /// Reject the promise. Err(InvokeError), } -impl InvokeResponse { - /// Turn a [`InvokeResponse`] back into a serializable result. - #[inline(always)] - pub fn into_result(self) -> Result { - match self { - Self::Ok(v) => Ok(v), - Self::Err(e) => Err(e.0), - } - } -} - impl From> for InvokeResponse { #[inline] fn from(result: Result) -> Self { match result { Ok(ok) => match serde_json::to_value(ok) { - Ok(value) => Self::Ok(value), + Ok(value) => Self::Ok(value.into()), Err(err) => Self::Err(InvokeError::from_serde_json(err)), }, Err(err) => Self::Err(err), @@ -208,7 +210,7 @@ impl InvokeResolver { { crate::async_runtime::spawn(async move { let response = match task.await { - Ok(ok) => InvokeResponse::Ok(ok), + Ok(ok) => InvokeResponse::Ok(ok.into()), Err(err) => InvokeResponse::Err(err), }; Self::return_result(self.window, response, self.callback, self.error) @@ -280,17 +282,18 @@ impl InvokeResolver { pub fn window_invoke_responder( window: Window, response: InvokeResponse, - success_callback: CallbackFn, - error_callback: CallbackFn, + callback: CallbackFn, + error: CallbackFn, ) { - let callback_string = - match format_callback_result(response.into_result(), success_callback, error_callback) { - Ok(callback_string) => callback_string, - Err(e) => format_callback(error_callback, &e.to_string()) - .expect("unable to serialize response string to json"), - }; - - let _ = window.eval(&callback_string); + if let Some(tx) = window + .state::() + .0 + .lock() + .unwrap() + .remove(&IpcKey { callback, error }) + { + tx.send(response).unwrap(); + } } /// An invoke message. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index e9c376613f8a..36a17cc809f2 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -10,6 +10,10 @@ use std::{ sync::{Arc, Mutex, MutexGuard}, }; +use http::{ + header::{ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, + HeaderValue, StatusCode, +}; use serde::Serialize; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use url::Url; @@ -26,7 +30,6 @@ use tauri_utils::{ #[cfg(feature = "isolation")] use crate::hooks::IsolationJavascript; -use crate::pattern::PatternJavascript; use crate::{api::ipc::CallbackFn, hooks::IpcJavascript}; use crate::{ app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, @@ -53,6 +56,7 @@ use crate::{ app::{GlobalMenuEventListener, WindowMenuEvent}, hooks::InvokePayloadValue, }; +use crate::{pattern::PatternJavascript, InvokeResponse}; #[cfg(any(target_os = "linux", target_os = "windows"))] use crate::path::BaseDirectory; @@ -580,8 +584,36 @@ impl WindowManager { { let manager = self.clone(); Box::new(move |request| { - let data = handle_ipc_request(request, &manager, &label)?; - Ok(HttpResponse::new(data.into())) + let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { + Ok(data) => match data { + InvokeResponse::Ok(InvokePayloadValue::Json(v)) => ( + HttpResponse::new(serde_json::to_vec(&v)?.into()), + "application/json", + ), + InvokeResponse::Ok(InvokePayloadValue::Raw(v)) => { + (HttpResponse::new(v.into()), "application/octet-stream") + } + InvokeResponse::Err(e) => { + let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }, + Err(e) => { + let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }; + + response + .headers_mut() + .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); + response + .headers_mut() + .insert(CONTENT_TYPE, HeaderValue::from_static(content_type)); + + Ok(response) }) } @@ -1407,19 +1439,22 @@ fn handle_ipc_request( request: &HttpRequest, manager: &WindowManager, label: &str, -) -> std::result::Result, String> { +) -> std::result::Result { if let Some(window) = manager.get_window(&label) { // TODO: consume instead let mut body = request.body().clone(); let cmd = request .uri() - .strip_prefix("ipc://localhost") + .strip_prefix("ipc://localhost/") .map(|c| c.to_string()) // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows // where `$P` is not `localhost/*` // in this case the IPC call is considered invalid .unwrap_or_else(|| "".to_string()); + let cmd = percent_encoding::percent_decode(cmd.as_bytes()) + .decode_utf8_lossy() + .to_string(); #[cfg(feature = "isolation")] if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { @@ -1458,10 +1493,10 @@ fn handle_ipc_request( .and_then(|h| h.to_str().ok()) .unwrap_or("application/octet-stream"); let data = match content_type { - "application/octet-stream" => InvokePayloadValue::Raw(body), - "application/json" => { - InvokePayloadValue::Json(serde_json::from_slice(&body).map_err(|e| e.to_string())?) - } + "application/octet-stream" => body.into(), + "application/json" => serde_json::from_slice::(&body) + .map_err(|e| e.to_string())? + .into(), _ => return Err(format!("unknown content type {content_type}")), }; diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 345c750735cf..994aa0a5e34b 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -32,8 +32,8 @@ use crate::{ sealed::ManagerBase, sealed::RuntimeOrDispatch, utils::config::{WindowConfig, WindowEffectsConfig, WindowUrl}, - EventLoopMessage, Invoke, InvokeError, InvokeMessage, InvokeResolver, Manager, PageLoadPayload, - Runtime, Theme, WindowEvent, + EventLoopMessage, Invoke, InvokeError, InvokeMessage, InvokeResolver, InvokeResponse, Manager, + PageLoadPayload, Runtime, Theme, WindowEvent, }; #[cfg(desktop)] use crate::{ @@ -67,8 +67,8 @@ pub(crate) type NavigationHandler = dyn Fn(Url) -> bool + Send; #[derive(Eq, PartialEq)] pub(crate) struct IpcKey { - callback: CallbackFn, - error: CallbackFn, + pub callback: CallbackFn, + pub error: CallbackFn, } impl Hash for IpcKey { @@ -79,7 +79,7 @@ impl Hash for IpcKey { } #[derive(Default)] -pub(crate) struct IpcStore(Mutex>>>); +pub(crate) struct IpcStore(pub(crate) Mutex>>); #[derive(Clone, Serialize)] struct WindowCreatedEvent { @@ -1672,8 +1672,8 @@ impl Window { self.current_url = url; } - /// Handles this window receiving an [`InvokeMessage`] and returns the response. - pub fn on_message(self, payload: InvokePayload) -> Result, String> { + /// Handles this window receiving an [`InvokeMessage`] and returns the [`InvokeResponse`]. + pub fn on_message(self, payload: InvokePayload) -> Result { let manager = self.manager.clone(); let current_url = self.url(); let config_url = manager.get_url(); @@ -1704,7 +1704,7 @@ impl Window { InvokePayloadValue::Raw(v) => serde_json::from_slice(&v).map_err(|e| e.to_string())?, }; manager.run_on_page_load(self, payload); - Ok(Vec::new()) + Ok(InvokeResponse::Ok(Vec::new().into())) } _ => { let message = InvokeMessage::new( @@ -1858,7 +1858,8 @@ impl Window { } } - Ok(rx.recv().unwrap()) + let response = rx.recv().unwrap(); + Ok(response) } } } From 31ad0272450cc98276f055a739fd59ccc7cc528c Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 8 Jun 2023 16:45:47 -0300 Subject: [PATCH 03/90] feat: allow reading raw request and returning raw response bytes --- core/tauri/src/api/ipc.rs | 55 +++++++++++++++++++++++ core/tauri/src/command.rs | 75 ++++++++++++++++--------------- core/tauri/src/hooks.rs | 50 ++++++++++----------- core/tauri/src/lib.rs | 2 +- core/tauri/src/manager.rs | 15 ++++--- core/tauri/src/scope/ipc.rs | 16 +++---- core/tauri/src/window.rs | 24 +++++----- examples/commands/index.html | 4 +- examples/commands/main.rs | 12 ++++- examples/commands/tauri.conf.json | 2 +- 10 files changed, 162 insertions(+), 93 deletions(-) diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index fda6910f8429..76d325e945cf 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -14,6 +14,7 @@ use tauri_macros::default_runtime; use crate::{ command::{CommandArg, CommandItem}, + hooks::InvokeBody, InvokeError, Runtime, Window, }; @@ -66,6 +67,60 @@ impl<'de, R: Runtime> CommandArg<'de, R> for Channel { } } +/// The IPC request. +#[derive(Debug)] +pub struct Request<'a> { + body: &'a InvokeBody, +} + +impl<'a> Request<'a> { + /// The request body. + pub fn body(&self) -> &InvokeBody { + &self.body + } +} + +impl<'a, R: Runtime> CommandArg<'a, R> for Request<'a> { + /// Returns the invoke [`Request`]. + fn from_command(command: CommandItem<'a, R>) -> Result { + Ok(Self { + body: &command.message.payload, + }) + } +} + +/// Marks a type as a response to an IPC call. +pub trait IpcResponse { + /// Resolve the IPC response body. + fn body(self) -> crate::Result; +} + +impl IpcResponse for T { + fn body(self) -> crate::Result { + serde_json::to_value(self) + .map(Into::into) + .map_err(Into::into) + } +} + +/// The IPC request. +pub struct Response { + body: InvokeBody, +} + +impl IpcResponse for Response { + fn body(self) -> crate::Result { + Ok(self.body) + } +} + +impl Response { + /// Defines a response with the given body. + pub fn new(body: impl Into) -> Self { + Self { body: body.into() } + } +} + /// The `Callback` type is the return value of the `transformCallback` JavaScript function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] pub struct CallbackFn(pub usize); diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index ebb1a9cfcb7f..1128e33b0ee9 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -7,7 +7,7 @@ //! You usually don't need to create these items yourself. These are created from [command](../attr.command.html) //! attribute macro along the way and used by [`crate::generate_handler`] macro. -use crate::hooks::{InvokeError, InvokePayloadValue}; +use crate::hooks::{InvokeBody, InvokeError}; use crate::InvokeMessage; use crate::Runtime; use serde::{ @@ -72,13 +72,13 @@ macro_rules! pass { } match &self.message.payload { - InvokePayloadValue::Raw(_body) => { + InvokeBody::Raw(_body) => { Err(serde_json::Error::custom(format!( "command {} expected a value for key {} but the IPC call used a bytes payload", self.name, self.key ))) } - InvokePayloadValue::Json(v) => { + InvokeBody::Json(v) => { match v.get(self.key) { Some(value) => value.$fn($($arg),*), None => { @@ -122,11 +122,11 @@ impl<'de, R: Runtime> Deserializer<'de> for CommandItem<'de, R> { fn deserialize_option>(self, visitor: V) -> Result { match &self.message.payload { - InvokePayloadValue::Raw(_body) => Err(serde_json::Error::custom(format!( + InvokeBody::Raw(_body) => Err(serde_json::Error::custom(format!( "command {} expected a value for key {} but the IPC call used a bytes payload", self.name, self.key ))), - InvokePayloadValue::Json(v) => match v.get(self.key) { + InvokeBody::Json(v) => match v.get(self.key) { Some(value) => value.deserialize_option(visitor), None => visitor.visit_none(), }, @@ -171,46 +171,44 @@ impl<'de, R: Runtime> Deserializer<'de> for CommandItem<'de, R> { /// Nothing in this module is considered stable. #[doc(hidden)] pub mod private { - use crate::{InvokeError, InvokeResolver, Runtime}; + use crate::{api::ipc::IpcResponse, hooks::InvokeBody, InvokeError, InvokeResolver, Runtime}; use futures_util::{FutureExt, TryFutureExt}; - use serde::Serialize; - use serde_json::Value; use std::future::Future; - // ===== impl Serialize ===== + // ===== impl IpcResponse ===== - pub struct SerializeTag; + pub struct ResponseTag; - pub trait SerializeKind { + pub trait ResponseKind { #[inline(always)] - fn blocking_kind(&self) -> SerializeTag { - SerializeTag + fn blocking_kind(&self) -> ResponseTag { + ResponseTag } #[inline(always)] - fn async_kind(&self) -> SerializeTag { - SerializeTag + fn async_kind(&self) -> ResponseTag { + ResponseTag } } - impl SerializeKind for &T {} + impl ResponseKind for &T {} - impl SerializeTag { + impl ResponseTag { #[inline(always)] pub fn block(self, value: T, resolver: InvokeResolver) where R: Runtime, - T: Serialize, + T: IpcResponse, { resolver.respond(Ok(value)) } #[inline(always)] - pub fn future(self, value: T) -> impl Future> + pub fn future(self, value: T) -> impl Future> where - T: Serialize, + T: IpcResponse, { - std::future::ready(serde_json::to_value(value).map_err(InvokeError::from_serde_json)) + std::future::ready(value.body().map_err(InvokeError::from_error)) } } @@ -230,14 +228,14 @@ pub mod private { } } - impl> ResultKind for Result {} + impl> ResultKind for Result {} impl ResultTag { #[inline(always)] pub fn block(self, value: Result, resolver: InvokeResolver) where R: Runtime, - T: Serialize, + T: IpcResponse, E: Into, { resolver.respond(value.map_err(Into::into)) @@ -247,20 +245,20 @@ pub mod private { pub fn future( self, value: Result, - ) -> impl Future> + ) -> impl Future> where - T: Serialize, + T: IpcResponse, E: Into, { std::future::ready( value .map_err(Into::into) - .and_then(|value| serde_json::to_value(value).map_err(InvokeError::from_serde_json)), + .and_then(|value| value.body().map_err(InvokeError::from_error)), ) } } - // ===== Future ===== + // ===== Future ===== pub struct FutureTag; @@ -270,16 +268,16 @@ pub mod private { FutureTag } } - impl> FutureKind for &F {} + impl> FutureKind for &F {} impl FutureTag { #[inline(always)] - pub fn future(self, value: F) -> impl Future> + pub fn future(self, value: F) -> impl Future> where - T: Serialize, + T: IpcResponse, F: Future + Send + 'static, { - value.map(|value| serde_json::to_value(value).map_err(InvokeError::from_serde_json)) + value.map(|value| value.body().map_err(InvokeError::from_error)) } } @@ -294,19 +292,22 @@ pub mod private { } } - impl, F: Future>> ResultFutureKind for F {} + impl, F: Future>> ResultFutureKind + for F + { + } impl ResultFutureTag { #[inline(always)] - pub fn future(self, value: F) -> impl Future> + pub fn future(self, value: F) -> impl Future> where - T: Serialize, + T: IpcResponse, E: Into, F: Future> + Send, { - value.err_into().map(|result| { - result.and_then(|value| serde_json::to_value(value).map_err(InvokeError::from_serde_json)) - }) + value + .err_into() + .map(|result| result.and_then(|value| value.body().map_err(InvokeError::from_error))) } } } diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index f997832dc5ff..4f020bbd2095 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use crate::{ - api::ipc::CallbackFn, + api::ipc::{CallbackFn, IpcResponse}, app::App, window::{IpcKey, IpcStore}, Manager, Runtime, StateManager, Window, @@ -59,36 +59,36 @@ impl PageLoadPayload { /// Possible values of an IPC payload. #[derive(Debug, Clone)] -pub enum InvokePayloadValue { +pub enum InvokeBody { /// Json payload. Json(JsonValue), /// Bytes payload. Raw(Vec), } -impl From for InvokePayloadValue { +impl From for InvokeBody { fn from(value: JsonValue) -> Self { Self::Json(value) } } -impl From> for InvokePayloadValue { +impl From> for InvokeBody { fn from(value: Vec) -> Self { Self::Raw(value) } } -/// The payload used on the IPC invoke. +/// The IPC invoke request. #[derive(Debug)] -pub struct InvokePayload { +pub struct InvokeRequest { /// The invoke command. pub cmd: String, /// The success callback. pub callback: CallbackFn, /// The error callback. pub error: CallbackFn, - /// The payload of the message. - pub inner: InvokePayloadValue, + /// The body of the request. + pub body: InvokeBody, } /// The message and resolver given to a custom command. @@ -107,9 +107,9 @@ pub struct Invoke { pub struct InvokeError(pub JsonValue); impl InvokeError { - /// Create an [`InvokeError`] as a string of the [`serde_json::Error`] message. + /// Create an [`InvokeError`] as a string of the [`std::error::Error`] message. #[inline(always)] - pub fn from_serde_json(error: serde_json::Error) -> Self { + pub fn from_error(error: E) -> Self { Self(JsonValue::String(error.to_string())) } @@ -125,7 +125,7 @@ impl From for InvokeError { fn from(value: T) -> Self { serde_json::to_value(value) .map(Self) - .unwrap_or_else(Self::from_serde_json) + .unwrap_or_else(Self::from_error) } } @@ -140,18 +140,18 @@ impl From for InvokeError { #[derive(Debug)] pub enum InvokeResponse { /// Resolve the promise. - Ok(InvokePayloadValue), + Ok(InvokeBody), /// Reject the promise. Err(InvokeError), } -impl From> for InvokeResponse { +impl From> for InvokeResponse { #[inline] fn from(result: Result) -> Self { match result { - Ok(ok) => match serde_json::to_value(ok) { + Ok(ok) => match ok.body() { Ok(value) => Self::Ok(value.into()), - Err(err) => Self::Err(InvokeError::from_serde_json(err)), + Err(err) => Self::Err(InvokeError::from_error(err)), }, Err(err) => Self::Err(err), } @@ -195,7 +195,7 @@ impl InvokeResolver { /// Reply to the invoke promise with an async task. pub fn respond_async(self, task: F) where - T: Serialize, + T: IpcResponse, F: Future> + Send + 'static, { crate::async_runtime::spawn(async move { @@ -206,7 +206,7 @@ impl InvokeResolver { /// Reply to the invoke promise with an async task which is already serialized. pub fn respond_async_serialized(self, task: F) where - F: Future> + Send + 'static, + F: Future> + Send + 'static, { crate::async_runtime::spawn(async move { let response = match task.await { @@ -218,13 +218,13 @@ impl InvokeResolver { } /// Reply to the invoke promise with a serializable value. - pub fn respond(self, value: Result) { + pub fn respond(self, value: Result) { Self::return_result(self.window, value.into(), self.callback, self.error) } /// Resolve the invoke promise with a value. - pub fn resolve(self, value: T) { - Self::return_result(self.window, Ok(value).into(), self.callback, self.error) + pub fn resolve(self, value: T) { + self.respond(Ok(value)) } /// Reject the invoke promise with a value. @@ -253,14 +253,14 @@ impl InvokeResolver { success_callback: CallbackFn, error_callback: CallbackFn, ) where - T: Serialize, + T: IpcResponse, F: Future> + Send + 'static, { let result = task.await; Self::return_closure(window, || result, success_callback, error_callback) } - pub(crate) fn return_closure Result>( + pub(crate) fn return_closure Result>( window: Window, f: F, success_callback: CallbackFn, @@ -307,7 +307,7 @@ pub struct InvokeMessage { /// The IPC command. pub(crate) command: String, /// The JSON argument passed on the invoke message. - pub(crate) payload: InvokePayloadValue, + pub(crate) payload: InvokeBody, } impl Clone for InvokeMessage { @@ -327,7 +327,7 @@ impl InvokeMessage { window: Window, state: Arc, command: String, - payload: InvokePayloadValue, + payload: InvokeBody, ) -> Self { Self { window, @@ -357,7 +357,7 @@ impl InvokeMessage { /// A reference to the payload the invoke received. #[inline(always)] - pub fn payload(&self) -> &InvokePayloadValue { + pub fn payload(&self) -> &InvokeBody { &self.payload } diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index a68f2bcd47ae..16d93bf9cdb0 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -174,7 +174,7 @@ pub use { WindowEvent, }, self::hooks::{ - Invoke, InvokeError, InvokeHandler, InvokeMessage, InvokePayload, InvokeResolver, + Invoke, InvokeError, InvokeHandler, InvokeMessage, InvokeRequest, InvokeResolver, InvokeResponder, InvokeResponse, OnPageLoad, PageLoadPayload, SetupHook, }, self::manager::Asset, diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 36a17cc809f2..e47d464679a8 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -34,7 +34,7 @@ use crate::{api::ipc::CallbackFn, hooks::IpcJavascript}; use crate::{ app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, - hooks::{InvokeHandler, InvokePayload, InvokeResponder, OnPageLoad, PageLoadPayload}, + hooks::{InvokeHandler, InvokeRequest, InvokeResponder, OnPageLoad, PageLoadPayload}, plugin::PluginStore, runtime::{ http::{ @@ -54,7 +54,7 @@ use crate::{ }; use crate::{ app::{GlobalMenuEventListener, WindowMenuEvent}, - hooks::InvokePayloadValue, + hooks::InvokeBody, }; use crate::{pattern::PatternJavascript, InvokeResponse}; @@ -586,11 +586,11 @@ impl WindowManager { Box::new(move |request| { let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { Ok(data) => match data { - InvokeResponse::Ok(InvokePayloadValue::Json(v)) => ( + InvokeResponse::Ok(InvokeBody::Json(v)) => ( HttpResponse::new(serde_json::to_vec(&v)?.into()), "application/json", ), - InvokeResponse::Ok(InvokePayloadValue::Raw(v)) => { + InvokeResponse::Ok(InvokeBody::Raw(v)) => { (HttpResponse::new(v.into()), "application/octet-stream") } InvokeResponse::Err(e) => { @@ -1442,6 +1442,7 @@ fn handle_ipc_request( ) -> std::result::Result { if let Some(window) = manager.get_window(&label) { // TODO: consume instead + #[allow(unused_mut)] let mut body = request.body().clone(); let cmd = request @@ -1492,7 +1493,7 @@ fn handle_ipc_request( .get(reqwest::header::CONTENT_TYPE) .and_then(|h| h.to_str().ok()) .unwrap_or("application/octet-stream"); - let data = match content_type { + let body = match content_type { "application/octet-stream" => body.into(), "application/json" => serde_json::from_slice::(&body) .map_err(|e| e.to_string())? @@ -1500,11 +1501,11 @@ fn handle_ipc_request( _ => return Err(format!("unknown content type {content_type}")), }; - let payload = InvokePayload { + let payload = InvokeRequest { cmd, callback, error, - inner: data, + body, }; window.on_message(payload).map_err(|e| e.to_string()) diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index b9540a81ed74..9f655906fdf6 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -169,7 +169,7 @@ mod tests { use serde::Serialize; use super::RemoteDomainAccessScope; - use crate::{api::ipc::CallbackFn, test::MockRuntime, App, InvokePayload, Manager, Window}; + use crate::{api::ipc::CallbackFn, test::MockRuntime, App, InvokeRequest, Manager, Window}; const PLUGIN_NAME: &str = "test"; @@ -186,7 +186,7 @@ mod tests { fn assert_ipc_response( window: &Window, - payload: InvokePayload, + payload: InvokeRequest, expected: Result, ) { let callback = payload.callback; @@ -222,7 +222,7 @@ mod tests { assert!(evaluated_script.contains(&expected)); } - fn path_is_absolute_payload() -> InvokePayload { + fn path_is_absolute_payload() -> InvokeRequest { let callback = CallbackFn(0); let error = CallbackFn(1); @@ -232,7 +232,7 @@ mod tests { serde_json::Value::String(std::env::current_dir().unwrap().display().to_string()), ); - InvokePayload { + InvokeRequest { cmd: "plugin:path|is_absolute".into(), callback, error, @@ -240,11 +240,11 @@ mod tests { } } - fn plugin_test_payload() -> InvokePayload { + fn plugin_test_request() -> InvokeRequest { let callback = CallbackFn(0); let error = CallbackFn(1); - InvokePayload { + InvokeRequest { cmd: format!("plugin:{PLUGIN_NAME}|doSomething"), callback, error, @@ -370,7 +370,7 @@ mod tests { window.navigate("https://tauri.app".parse().unwrap()); assert_ipc_response::<()>( &window, - plugin_test_payload(), + plugin_test_request(), Err(&format!("plugin {PLUGIN_NAME} not found")), ); } @@ -384,7 +384,7 @@ mod tests { window.navigate("https://tauri.app".parse().unwrap()); assert_ipc_response::<()>( &window, - plugin_test_payload(), + plugin_test_request(), Err(crate::window::IPC_SCOPE_DOES_NOT_ALLOW), ); } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 994aa0a5e34b..48d39add0f2a 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -17,7 +17,7 @@ use crate::{ app::AppHandle, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, - hooks::{InvokePayload, InvokePayloadValue, InvokeResponder}, + hooks::{InvokeBody, InvokeRequest, InvokeResponder}, manager::WindowManager, runtime::{ http::{Request as HttpRequest, Response as HttpResponse}, @@ -1673,7 +1673,7 @@ impl Window { } /// Handles this window receiving an [`InvokeMessage`] and returns the [`InvokeResponse`]. - pub fn on_message(self, payload: InvokePayload) -> Result { + pub fn on_message(self, request: InvokeRequest) -> Result { let manager = self.manager.clone(); let current_url = self.url(); let config_url = manager.get_url(); @@ -1697,11 +1697,11 @@ impl Window { } } }; - match payload.cmd.as_str() { + match request.cmd.as_str() { "__initialized" => { - let payload: PageLoadPayload = match payload.inner { - InvokePayloadValue::Json(v) => serde_json::from_value(v).map_err(|e| e.to_string())?, - InvokePayloadValue::Raw(v) => serde_json::from_slice(&v).map_err(|e| e.to_string())?, + let payload: PageLoadPayload = match request.body { + InvokeBody::Json(v) => serde_json::from_value(v).map_err(|e| e.to_string())?, + InvokeBody::Raw(v) => serde_json::from_slice(&v).map_err(|e| e.to_string())?, }; manager.run_on_page_load(self, payload); Ok(InvokeResponse::Ok(Vec::new().into())) @@ -1710,18 +1710,18 @@ impl Window { let message = InvokeMessage::new( self.clone(), manager.state(), - payload.cmd.to_string(), - payload.inner, + request.cmd.to_string(), + request.body, ); - let resolver = InvokeResolver::new(self.clone(), payload.callback, payload.error); + let resolver = InvokeResolver::new(self.clone(), request.callback, request.error); let mut invoke = Invoke { message, resolver }; let (tx, rx) = channel(); self.state::().0.lock().unwrap().insert( IpcKey { - callback: payload.callback, - error: payload.error, + callback: request.callback, + error: request.error, }, tx, ); @@ -1730,7 +1730,7 @@ impl Window { return Err(scope_not_found_error_message); } - if payload.cmd.starts_with("plugin:") { + if request.cmd.starts_with("plugin:") { if !is_local { let command = invoke.message.command.replace("plugin:", ""); let plugin_name = command.split('|').next().unwrap().to_string(); diff --git a/examples/commands/index.html b/examples/commands/index.html index 35a307593db6..3abb8cb8a7e7 100644 --- a/examples/commands/index.html +++ b/examples/commands/index.html @@ -18,7 +18,8 @@

Tauri Commands

window.__TAURI__ .invoke(commandName, args) .then((response) => { - result.innerText = `Ok(${response})` + const val = response instanceof ArrayBuffer ? new TextDecoder().decode(response) : response + result.innerText = `Ok(${val})` }) .catch((error) => { result.innerText = `Err(${error})` @@ -28,6 +29,7 @@

Tauri Commands

const container = document.querySelector('#container') const commands = [ { name: 'borrow_cmd' }, + { name: 'raw_request' }, { name: 'window_label' }, { name: 'simple_command' }, { name: 'stateful_command' }, diff --git a/examples/commands/main.rs b/examples/commands/main.rs index 0ae6b58f183f..ca2fe76877ed 100644 --- a/examples/commands/main.rs +++ b/examples/commands/main.rs @@ -9,7 +9,10 @@ mod commands; use commands::{cmd, invoke, message, resolver}; use serde::Deserialize; -use tauri::{command, State, Window}; +use tauri::{ + api::ipc::{Request, Response}, + command, State, Window, +}; #[derive(Debug)] pub struct MyState { @@ -213,6 +216,12 @@ fn borrow_cmd_async(the_argument: &str) -> &str { the_argument } +#[command] +fn raw_request(request: Request<'_>) -> Response { + println!("{:?}", request); + Response::new(include_bytes!("./README.md").to_vec()) +} + fn main() { tauri::Builder::default() .manage(MyState { @@ -222,6 +231,7 @@ fn main() { .invoke_handler(tauri::generate_handler![ borrow_cmd, borrow_cmd_async, + raw_request, window_label, force_async, force_async_with_result, diff --git a/examples/commands/tauri.conf.json b/examples/commands/tauri.conf.json index 1393d40432ca..c82fbb4e224c 100644 --- a/examples/commands/tauri.conf.json +++ b/examples/commands/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } From 7b9cd474310a46ee235673dab083d44dd13f9695 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 10 Jun 2023 08:17:36 -0300 Subject: [PATCH 04/90] mobile impl [skip ci] --- core/tauri-runtime-wry/Cargo.toml | 2 +- core/tauri-runtime-wry/src/lib.rs | 7 +- .../java/app/tauri/plugin/PluginManager.kt | 9 - .../mobile/ios-api/Sources/Tauri/Tauri.swift | 16 +- core/tauri/scripts/bundle.global.js | 2 +- core/tauri/scripts/core.js | 7 + core/tauri/scripts/ipc-post-message.js | 11 +- core/tauri/scripts/process-ipc-message-fn.js | 6 +- core/tauri/src/api/ipc.rs | 2 +- core/tauri/src/hooks.rs | 26 +- core/tauri/src/ios.rs | 10 +- core/tauri/src/manager.rs | 103 +++--- core/tauri/src/plugin/mobile.rs | 299 +++++++++--------- core/tauri/src/window.rs | 109 ++----- examples/api/dist/assets/index.js | 16 +- examples/api/src-tauri/Cargo.lock | 151 ++++++--- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 2 +- 18 files changed, 400 insertions(+), 380 deletions(-) diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 63815c9ad758..a57655e0c586 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { version = "0.28.3", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } +wry = { git = "https://github.com/tauri-apps/wry", branch = "feat/android-protocol-req-body", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 6a964e1d9f2b..0021816f907a 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -3006,9 +3006,6 @@ fn create_webview( on_webview_created, .. } = pending; - let webview_id_map = context.webview_id_map.clone(); - #[cfg(windows)] - let proxy = context.proxy.clone(); let window_event_listeners = WindowEventListeners::default(); @@ -3043,7 +3040,7 @@ fn create_webview( }; let window = window_builder.inner.build(event_loop).unwrap(); - webview_id_map.insert(window.id(), window_id); + context.webview_id_map.insert(window.id(), window_id); if window_builder.center { let _ = center_window(&window, window.inner_size()); @@ -3152,7 +3149,7 @@ fn create_webview( #[cfg(windows)] { let controller = webview.controller(); - let proxy_ = proxy.clone(); + let proxy_ = context.proxy.clone(); let mut token = EventRegistrationToken::default(); unsafe { controller.add_GotFocus( diff --git a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt index 7dbab66429f8..efb86ddd97b0 100644 --- a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt +++ b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt @@ -85,15 +85,6 @@ class PluginManager(val activity: AppCompatActivity) { } } - @JniMethod - fun postIpcMessage(webView: WebView, pluginId: String, command: String, data: JSObject, callback: Long, error: Long) { - val invoke = Invoke(callback, command, callback, error, { fn, result -> - webView.evaluateJavascript("window['_$fn']($result)", null) - }, data) - - dispatchPluginMessage(invoke, pluginId) - } - @JniMethod fun runCommand(id: Int, pluginId: String, command: String, data: JSObject) { val successId = 0L diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift index b5f4ec6531e8..51808dccac45 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift @@ -108,21 +108,7 @@ func onWebviewCreated(webview: WKWebView, viewController: UIViewController) { PluginManager.shared.onWebviewCreated(webview) } -@_cdecl("post_ipc_message") -func postIpcMessage(webview: WKWebView, name: SRString, command: SRString, data: NSDictionary, callback: UInt64, error: UInt64) { - let invoke = Invoke(command: command.toString(), callback: callback, error: error, sendResponse: { (fn: UInt64, payload: JsonValue?) -> Void in - var payloadJson: String - do { - try payloadJson = payload == nil ? "null" : payload!.jsonRepresentation() ?? "`Failed to serialize payload`" - } catch { - payloadJson = "`\(error)`" - } - webview.evaluateJavaScript("window['_\(fn)'](\(payloadJson))") - }, data: JSTypes.coerceDictionaryToJSObject(data, formattingDatesAsStrings: true)) - PluginManager.shared.invoke(name: name.toString(), invoke: invoke) -} - -@_cdecl("run_plugin_method") +@_cdecl("run_plugin_command") func runCommand( id: Int, name: SRString, diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 9c72692d0cfb..b4bf33d7c0c5 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},W=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(P(n,e,"read from private field"),i?i.call(n):e.get(n)),D=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},w=(n,e,i,o)=>(P(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>b,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){w(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:e})})}function k(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function A(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function I(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>A(n,o))}async function U(n,e,i){return I(n,o=>{e(o),A(n,o.id).catch(()=>{})},i)}async function F(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>nn,runtimeDir:()=>rn,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function rn(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},W=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(P(n,e,"read from private field"),i?i.call(n):e.get(n)),D=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},w=(n,e,i,o)=>(P(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>A,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){w(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:e})})}function k(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var A=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(A||{});async function b(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function I(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>b(n,o))}async function U(n,e,i){return I(n,o=>{e(o),b(n,o.id).catch(()=>{})},i)}async function F(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>nn,runtimeDir:()=>rn,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function rn(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 160e43637620..85aeb6c8bb87 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -13,6 +13,13 @@ }) } + window.__TAURI__.convertFileSrc = function convertFileSrc(filePath, protocol = 'asset') { + const path = encodeURIComponent(filePath) + return navigator.userAgent.includes('Windows') || navigator.userAgent.includes('Android') + ? `https://${protocol}.localhost/${path}` + : `${protocol}://localhost/${path}` + } + window.__TAURI__.transformCallback = function transformCallback( callback, once diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js index a113656ede43..a63d34c5b1f1 100644 --- a/core/tauri/scripts/ipc-post-message.js +++ b/core/tauri/scripts/ipc-post-message.js @@ -7,7 +7,7 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload } = message const { contentType, data } = __RAW_process_ipc_message_fn__(payload) - fetch(`ipc://localhost/${cmd}`, { + fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { method: 'POST', body: data, headers: { @@ -17,7 +17,8 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { } }).then((response) => { const cb = response.ok ? callback : error - switch (response.headers.get('content-type')) { + // we need to split here because on Android the content-type gets duplicated + switch ((response.headers.get('content-type') || '').split(',')[0]) { case 'application/json': return response.json().then((r) => [cb, r]) case 'text/plain': @@ -26,7 +27,11 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { return response.arrayBuffer().then((r) => [cb, r]) } }).then(([cb, data]) => { - window[`_${cb}`](data) + if (window[`_${cb}`]) { + window[`_${cb}`](data) + } else { + console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) + } }) }}) })() diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js index 4474cd38c9e3..66191fa65dac 100644 --- a/core/tauri/scripts/process-ipc-message-fn.js +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -3,7 +3,11 @@ // SPDX-License-Identifier: MIT (function (message) { - if (message instanceof ArrayBuffer || Array.isArray(message)) { + // on Android we must send the body as a string + if ( + !navigator.appVersion.includes("Android") && + (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) + ) { return { contentType: 'application/octet-stream', data: message diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index 76d325e945cf..e23e4d537dec 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -76,7 +76,7 @@ pub struct Request<'a> { impl<'a> Request<'a> { /// The request body. pub fn body(&self) -> &InvokeBody { - &self.body + self.body } } diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index 4f020bbd2095..c01b76edb4c9 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -78,6 +78,18 @@ impl From> for InvokeBody { } } +impl InvokeBody { + #[cfg(mobile)] + pub(crate) fn to_json(self) -> JsonValue { + match self { + Self::Json(v) => v, + Self::Raw(v) => { + JsonValue::Array(v.into_iter().map(|n| JsonValue::Number(n.into())).collect()) + } + } + } +} + /// The IPC invoke request. #[derive(Debug)] pub struct InvokeRequest { @@ -132,7 +144,7 @@ impl From for InvokeError { impl From for InvokeError { #[inline(always)] fn from(error: crate::Error) -> Self { - Self(JsonValue::String(error.to_string()).into()) + Self(JsonValue::String(error.to_string())) } } @@ -145,15 +157,15 @@ pub enum InvokeResponse { Err(InvokeError), } -impl From> for InvokeResponse { +impl> From> for InvokeResponse { #[inline] - fn from(result: Result) -> Self { + fn from(result: Result) -> Self { match result { Ok(ok) => match ok.body() { - Ok(value) => Self::Ok(value.into()), + Ok(value) => Self::Ok(value), Err(err) => Self::Err(InvokeError::from_error(err)), }, - Err(err) => Self::Err(err), + Err(err) => Self::Err(err.into()), } } } @@ -210,7 +222,7 @@ impl InvokeResolver { { crate::async_runtime::spawn(async move { let response = match task.await { - Ok(ok) => InvokeResponse::Ok(ok.into()), + Ok(ok) => InvokeResponse::Ok(ok), Err(err) => InvokeResponse::Err(err), }; Self::return_result(self.window, response, self.callback, self.error) @@ -231,7 +243,7 @@ impl InvokeResolver { pub fn reject(self, value: T) { Self::return_result( self.window, - Result::<(), _>::Err(value.into()).into(), + Result::<(), _>::Err(value).into(), self.callback, self.error, ) diff --git a/core/tauri/src/ios.rs b/core/tauri/src/ios.rs index 5b9af9ec3d89..dd7f5e5d6433 100644 --- a/core/tauri/src/ios.rs +++ b/core/tauri/src/ios.rs @@ -23,15 +23,7 @@ impl<'a> SwiftArg<'a> for PluginMessageCallback { } } -swift!(pub fn post_ipc_message( - webview: *const c_void, - name: &SRString, - method: &SRString, - data: *const c_void, - callback: usize, - error: usize -)); -swift!(pub fn run_plugin_method( +swift!(pub fn run_plugin_command( id: i32, name: &SRString, method: &SRString, diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index e47d464679a8..d26bd4a581c9 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -11,8 +11,8 @@ use std::{ }; use http::{ - header::{ACCESS_CONTROL_ALLOW_ORIGIN, CONTENT_TYPE}, - HeaderValue, StatusCode, + header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN}, + HeaderValue, Method, StatusCode, }; use serde::Serialize; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; @@ -30,7 +30,11 @@ use tauri_utils::{ #[cfg(feature = "isolation")] use crate::hooks::IsolationJavascript; -use crate::{api::ipc::CallbackFn, hooks::IpcJavascript}; +use crate::{ + api::ipc::CallbackFn, + hooks::IpcJavascript, + window::{UriSchemeProtocolHandler, WebResourceRequestHandler}, +}; use crate::{ app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, @@ -383,9 +387,9 @@ impl WindowManager { pub(crate) fn get_url(&self) -> Cow<'_, Url> { match self.base_path() { AppUrl::Url(WindowUrl::External(url)) => Cow::Borrowed(url), - #[cfg(windows)] + #[cfg(any(windows, target_os = "android"))] _ => Cow::Owned(Url::parse("https://tauri.localhost").unwrap()), - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "android")))] _ => Cow::Owned(Url::parse("tauri://localhost").unwrap()), } } @@ -577,41 +581,63 @@ impl WindowManager { Ok(pending) } - fn prepare_ipc_scheme_protocol( - &self, - label: String, - ) -> Box Result> + Send + Sync> - { + fn prepare_ipc_scheme_protocol(&self, label: String) -> UriSchemeProtocolHandler { let manager = self.clone(); Box::new(move |request| { - let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { - Ok(data) => match data { - InvokeResponse::Ok(InvokeBody::Json(v)) => ( - HttpResponse::new(serde_json::to_vec(&v)?.into()), - "application/json", - ), - InvokeResponse::Ok(InvokeBody::Raw(v)) => { - (HttpResponse::new(v.into()), "application/octet-stream") - } - InvokeResponse::Err(e) => { - let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") - } - }, - Err(e) => { - let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") + let mut response = match *request.method() { + Method::POST => { + let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { + Ok(data) => match data { + InvokeResponse::Ok(InvokeBody::Json(v)) => ( + HttpResponse::new(serde_json::to_vec(&v)?.into()), + "application/json", + ), + InvokeResponse::Ok(InvokeBody::Raw(v)) => { + (HttpResponse::new(v.into()), "application/octet-stream") + } + InvokeResponse::Err(e) => { + let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }, + Err(e) => { + let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }; + + response.set_mimetype(Some(content_type.into())); + + response + } + + Method::OPTIONS => { + let mut r = HttpResponse::new(Vec::new().into()); + r.headers_mut().insert( + ACCESS_CONTROL_ALLOW_HEADERS, + HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error"), + ); + r + } + + _ => { + let mut r = HttpResponse::new( + "only POST and OPTIONS are allowed" + .as_bytes() + .to_vec() + .into(), + ); + r.set_status(StatusCode::METHOD_NOT_ALLOWED); + r.set_mimetype(Some("text/plain".into())); + r } }; response .headers_mut() .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); - response - .headers_mut() - .insert(CONTENT_TYPE, HeaderValue::from_static(content_type)); Ok(response) }) @@ -700,15 +726,11 @@ impl WindowManager { } } - #[allow(clippy::type_complexity)] fn prepare_uri_scheme_protocol( &self, window_origin: &str, - web_resource_request_handler: Option< - Box, - >, - ) -> Box Result> + Send + Sync> - { + web_resource_request_handler: Option>, + ) -> UriSchemeProtocolHandler { #[cfg(all(dev, mobile))] let url = { let mut url = self.get_url().as_str().to_string(); @@ -753,7 +775,6 @@ impl WindowManager { #[cfg(all(dev, mobile))] let mut response = { - use reqwest::StatusCode; let decoded_path = percent_encoding::percent_decode(path.as_bytes()) .decode_utf8_lossy() .to_string(); @@ -1440,7 +1461,7 @@ fn handle_ipc_request( manager: &WindowManager, label: &str, ) -> std::result::Result { - if let Some(window) = manager.get_window(&label) { + if let Some(window) = manager.get_window(label) { // TODO: consume instead #[allow(unused_mut)] let mut body = request.body().clone(); @@ -1508,7 +1529,7 @@ fn handle_ipc_request( body, }; - window.on_message(payload).map_err(|e| e.to_string()) + window.on_message(payload) } else { Err("window not found".into()) } diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 614aaf9aac7e..3f409a159af4 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -4,7 +4,7 @@ use super::{PluginApi, PluginHandle}; -use crate::Runtime; +use crate::{hooks::InvokeBody, AppHandle, Runtime}; #[cfg(target_os = "android")] use crate::{ runtime::RuntimeHandle, @@ -12,7 +12,7 @@ use crate::{ }; use once_cell::sync::OnceCell; -use serde::de::DeserializeOwned; +use serde::{de::DeserializeOwned, Serialize}; use std::{ collections::HashMap, @@ -20,8 +20,9 @@ use std::{ sync::{mpsc::channel, Mutex}, }; -type PendingPluginCallHandler = - Box) + Send + 'static>; +type PluginResponse = Result; + +type PendingPluginCallHandler = Box; static PENDING_PLUGIN_CALLS: OnceCell>> = OnceCell::new(); @@ -42,6 +43,9 @@ pub enum PluginInvokeError { /// Failed to deserialize response. #[error("failed to deserialize response: {0}")] CannotDeserializeResponse(serde_json::Error), + /// Failed to serialize request payload. + #[error("failed to serialize payload: {0}")] + CannotSerializePayload(serde_json::Error), } /// Glue between Rust and the Kotlin code that sends the plugin response back. @@ -236,81 +240,24 @@ impl PluginApi { } impl PluginHandle { - /// Executes the given mobile method. - pub fn run_mobile_plugin( + /// Executes the given mobile command. + pub fn run_mobile_plugin( &self, - method: impl AsRef, - payload: impl serde::Serialize, + command: impl AsRef, + payload: impl Serialize, ) -> Result { - #[cfg(target_os = "ios")] - { - self.run_ios_plugin(method, payload).map_err(Into::into) - } - #[cfg(target_os = "android")] - { - self.run_android_plugin(method, payload).map_err(Into::into) - } - } - - // Executes the given iOS method. - #[cfg(target_os = "ios")] - fn run_ios_plugin( - &self, - method: impl AsRef, - payload: impl serde::Serialize, - ) -> Result { - use std::{ - ffi::CStr, - os::raw::{c_char, c_int}, - }; - - let id: i32 = rand::random(); let (tx, rx) = channel(); - PENDING_PLUGIN_CALLS - .get_or_init(Default::default) - .lock() - .unwrap() - .insert( - id, - Box::new(move |arg| { - tx.send(arg).unwrap(); - }), - ); - - unsafe { - extern "C" fn plugin_method_response_handler( - id: c_int, - success: c_int, - payload: *const c_char, - ) { - let payload = unsafe { - assert!(!payload.is_null()); - CStr::from_ptr(payload) - }; - - if let Some(handler) = PENDING_PLUGIN_CALLS - .get_or_init(Default::default) - .lock() - .unwrap() - .remove(&id) - { - let payload = serde_json::from_str(payload.to_str().unwrap()).unwrap(); - handler(if success == 1 { - Ok(payload) - } else { - Err(payload) - }); - } - } - - crate::ios::run_plugin_method( - id, - &self.name.into(), - &method.as_ref().into(), - crate::ios::json_to_dictionary(&serde_json::to_value(payload).unwrap()) as _, - crate::ios::PluginMessageCallback(plugin_method_response_handler), - ); - } + run_command( + &self.name, + &self.handle, + command, + serde_json::to_value(payload) + .map_err(PluginInvokeError::CannotSerializePayload)? + .into(), + move |response| { + tx.send(response).unwrap(); + }, + )?; let response = rx.recv().unwrap(); match response { @@ -322,89 +269,137 @@ impl PluginHandle { ), } } +} - // Executes the given Android method. - #[cfg(target_os = "android")] - fn run_android_plugin( - &self, - method: impl AsRef, - payload: impl serde::Serialize, - ) -> Result { - use jni::{errors::Error as JniError, objects::JObject, JNIEnv}; - - fn run( - id: i32, - plugin: &'static str, - method: String, - payload: &serde_json::Value, - runtime_handle: &R::Handle, - env: JNIEnv<'_>, - activity: JObject<'_>, - ) -> Result<(), JniError> { - let data = crate::jni_helpers::to_jsobject::(env, activity, runtime_handle, payload)?; - let plugin_manager = env - .call_method( - activity, - "getPluginManager", - "()Lapp/tauri/plugin/PluginManager;", - &[], - )? - .l()?; +#[cfg(target_os = "ios")] +pub(crate) fn run_command, F: FnOnce(PluginResponse) + Send + 'static>( + name: &str, + _handle: &AppHandle, + command: C, + payload: InvokeBody, + handler: F, +) -> Result<(), PluginInvokeError> { + use std::{ + ffi::CStr, + os::raw::{c_char, c_int}, + }; - env.call_method( - plugin_manager, - "runCommand", - "(ILjava/lang/String;Ljava/lang/String;Lapp/tauri/plugin/JSObject;)V", - &[ - id.into(), - env.new_string(plugin)?.into(), - env.new_string(&method)?.into(), - data, - ], - )?; + let id: i32 = rand::random(); + PENDING_PLUGIN_CALLS + .get_or_init(Default::default) + .lock() + .unwrap() + .insert(id, Box::new(handler)); + + unsafe { + extern "C" fn plugin_command_response_handler( + id: c_int, + success: c_int, + payload: *const c_char, + ) { + let payload = unsafe { + assert!(!payload.is_null()); + CStr::from_ptr(payload) + }; - Ok(()) + if let Some(handler) = PENDING_PLUGIN_CALLS + .get_or_init(Default::default) + .lock() + .unwrap() + .remove(&id) + { + let payload = serde_json::from_str(payload.to_str().unwrap()).unwrap(); + handler(if success == 1 { + Ok(payload) + } else { + Err(payload) + }); + } } - let handle = match self.handle.runtime() { - RuntimeOrDispatch::Runtime(r) => r.handle(), - RuntimeOrDispatch::RuntimeHandle(h) => h, - _ => unreachable!(), - }; + crate::ios::run_plugin_command( + id, + &name.into(), + &command.as_ref().into(), + crate::ios::json_to_dictionary(&payload.to_json()) as _, + crate::ios::PluginMessageCallback(plugin_command_response_handler), + ); + } - let id: i32 = rand::random(); - let plugin_name = self.name; - let method = method.as_ref().to_string(); - let payload = serde_json::to_value(payload).unwrap(); - let handle_ = handle.clone(); + Ok(()) +} - let (tx, rx) = channel(); - let tx_ = tx.clone(); - PENDING_PLUGIN_CALLS - .get_or_init(Default::default) - .lock() - .unwrap() - .insert( - id, - Box::new(move |arg| { - tx.send(Ok(arg)).unwrap(); - }), - ); - - handle.run_on_android_context(move |env, activity, _webview| { - if let Err(e) = run::(id, plugin_name, method, &payload, &handle_, env, activity) { - tx_.send(Err(e)).unwrap(); - } - }); +#[cfg(target_os = "android")] +pub(crate) fn run_command< + R: Runtime, + C: AsRef, + F: FnOnce(PluginResponse) + Send + Clone + 'static, +>( + name: &str, + handle: &AppHandle, + command: C, + payload: InvokeBody, + handler: F, +) -> Result<(), PluginInvokeError> { + use jni::{errors::Error as JniError, objects::JObject, JNIEnv}; + + fn run( + id: i32, + plugin: &str, + command: String, + payload: &serde_json::Value, + runtime_handle: &R::Handle, + env: JNIEnv<'_>, + activity: JObject<'_>, + ) -> Result<(), JniError> { + let data = crate::jni_helpers::to_jsobject::(env, activity, runtime_handle, payload)?; + let plugin_manager = env + .call_method( + activity, + "getPluginManager", + "()Lapp/tauri/plugin/PluginManager;", + &[], + )? + .l()?; + + env.call_method( + plugin_manager, + "runCommand", + "(ILjava/lang/String;Ljava/lang/String;Lapp/tauri/plugin/JSObject;)V", + &[ + id.into(), + env.new_string(plugin)?.into(), + env.new_string(&command)?.into(), + data, + ], + )?; - let response = rx.recv().unwrap()?; - match response { - Ok(r) => serde_json::from_value(r).map_err(PluginInvokeError::CannotDeserializeResponse), - Err(r) => Err( - serde_json::from_value::(r) - .map(Into::into) - .map_err(PluginInvokeError::CannotDeserializeResponse)?, - ), - } + Ok(()) } + + let handle = match handle.runtime() { + RuntimeOrDispatch::Runtime(r) => r.handle(), + RuntimeOrDispatch::RuntimeHandle(h) => h, + _ => unreachable!(), + }; + + let id: i32 = rand::random(); + let plugin_name = name.to_string(); + let command = command.as_ref().to_string(); + let payload = payload.to_json(); + let handle_ = handle.clone(); + + PENDING_PLUGIN_CALLS + .get_or_init(Default::default) + .lock() + .unwrap() + .insert(id, Box::new(handler.clone())); + + handle.run_on_android_context(move |env, activity, _webview| { + if let Err(e) = run::(id, &plugin_name, command, &payload, &handle_, env, activity) { + handler(Err(e.to_string().into())); + } + }); + + Ok(()) } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 48d39add0f2a..506172a804c2 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -64,6 +64,8 @@ use std::{ pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; pub(crate) type NavigationHandler = dyn Fn(Url) -> bool + Send; +pub(crate) type UriSchemeProtocolHandler = + Box Result> + Send + Sync>; #[derive(Eq, PartialEq)] pub(crate) struct IpcKey { @@ -1672,13 +1674,14 @@ impl Window { self.current_url = url; } - /// Handles this window receiving an [`InvokeMessage`] and returns the [`InvokeResponse`]. + /// Handles this window receiving an [`InvokeRequest`] and returns the [`InvokeResponse`]. pub fn on_message(self, request: InvokeRequest) -> Result { let manager = self.manager.clone(); let current_url = self.url(); let config_url = manager.get_url(); - let is_local = - config_url.make_relative(¤t_url).is_some() || current_url.scheme() == "tauri"; + let is_local = config_url.make_relative(¤t_url).is_some() + || current_url.scheme() == "tauri" + || (cfg!(dev) && current_url.domain() == Some("tauri.localhost")); let mut scope_not_found_error_message = ipc_scope_not_found_error_message(&self.window.label, current_url.as_str()); @@ -1723,7 +1726,8 @@ impl Window { callback: request.callback, error: request.error, }, - tx, + #[allow(clippy::redundant_clone)] + tx.clone(), ); if !is_local && scope.is_none() { @@ -1752,98 +1756,25 @@ impl Window { let command = invoke.message.command.clone(); #[cfg(mobile)] - let (resolver, message) = (invoke.resolver.clone(), invoke.message.clone()); + let message = invoke.message.clone(); #[allow(unused_mut)] let mut handled = manager.extend_api(plugin, invoke); - #[cfg(target_os = "ios")] - { - if !handled { - handled = true; - let plugin = plugin.to_string(); - let (callback, error) = (resolver.callback, resolver.error); - self.with_webview(move |webview| { - unsafe { - crate::ios::post_ipc_message( - webview.inner() as _, - &plugin.as_str().into(), - &heck::ToLowerCamelCase::to_lower_camel_case(message.command.as_str()) - .as_str() - .into(), - crate::ios::json_to_dictionary(&message.payload) as _, - callback.0, - error.0, - ) - }; - })?; - } - } - - #[cfg(target_os = "android")] + #[cfg(mobile)] { if !handled { handled = true; - let resolver_ = resolver.clone(); - let runtime_handle = self.app_handle.runtime_handle.clone(); - let plugin = plugin.to_string(); - self.with_webview(move |webview| { - webview.jni_handle().exec(move |env, activity, webview| { - use jni::{ - errors::Error as JniError, - objects::JObject, - JNIEnv, - }; - - fn handle_message( - plugin: &str, - runtime_handle: &R::Handle, - message: InvokeMessage, - (callback, error): (CallbackFn, CallbackFn), - env: JNIEnv<'_>, - activity: JObject<'_>, - webview: JObject<'_>, - ) -> Result<(), JniError> { - let data = crate::jni_helpers::to_jsobject::(env, activity, runtime_handle, &message.payload)?; - let plugin_manager = env - .call_method( - activity, - "getPluginManager", - "()Lapp/tauri/plugin/PluginManager;", - &[], - )? - .l()?; - - env.call_method( - plugin_manager, - "postIpcMessage", - "(Landroid/webkit/WebView;Ljava/lang/String;Ljava/lang/String;Lapp/tauri/plugin/JSObject;JJ)V", - &[ - webview.into(), - env.new_string(plugin)?.into(), - env.new_string(&heck::ToLowerCamelCase::to_lower_camel_case(message.command.as_str()))?.into(), - data, - (callback.0 as i64).into(), - (error.0 as i64).into(), - ], - )?; - - Ok(()) - } - - if let Err(e) = handle_message( - &plugin, - &runtime_handle, - message, - (resolver_.callback, resolver_.error), - env, - activity, - webview, - ) { - resolver_.reject(format!("failed to reach Android layer: {e}")); - } - }); - })?; + crate::plugin::mobile::run_command( + &plugin, + &self.app_handle, + message.command, + message.payload, + move |response| { + tx.send(response.into()).unwrap(); + }, + ) + .map_err(|e| e.to_string())?; } } diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index b3f209165e58..419e9c2d73b0 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,9 +1,9 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&i(h)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function rt(e){return e()}function Ge(){return Object.create(null)}function F(e){e.forEach(rt)}function pt(e){return typeof e=="function"}function ue(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let be;function gt(e,t){return be||(be=document.createElement("a")),be.href=t,e===be.href}function _t(e){return Object.keys(e).length===0}function vt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function bt(e,t,n){e.$$.on_destroy.push(vt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Xe(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function l(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function wt(e){return Array.from(e.childNodes)}function kt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class Et{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=yt(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{ke.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Ke(e){e&&e.c()}function Ne(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:h,after_update:c}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(rt).filter(pt);h?h.push(...u):F(u),e.$$.on_mount=[]}),c.forEach(We)}function Ae(e,t){const n=e.$$;n.fragment!==null&&(F(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Dt(e,t){e.$$.dirty[0]===-1&&(le.push(e),xt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const S=R.length?R[0]:O;return d.ctx&&r(d.ctx[v],d.ctx[v]=S)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](S),E&&Dt(e,v)),O}):[],d.update(),E=!0,F(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=wt(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ie(e.$$.fragment),Ne(e,t.target,t.anchor,t.customElement),ct()}ce(u)}class Oe{$destroy(){Ae(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!_t(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const J=[];function Tt(e,t=$){let n;const i=new Set;function r(c){if(ue(e,c)&&(e=c,n)){const u=!J.length;for(const d of i)d[1](),J.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:h}}function Ct(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const m of a.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function l(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:m,after_update:c}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);m?m.push(...u):V(u),e.$$.on_mount=[]}),c.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(c){if(he(e,c)&&(e=c,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:m}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class Mt extends Oe{constructor(t){super(),Le(this,t,null,Ct,ue,{})}}var Wt=Object.defineProperty,at=(e,t)=>{for(var n in t)Wt(e,n,{get:t[n],enumerable:!0})},It={};at(It,{convertFileSrc:()=>At,invoke:()=>xe,transformCallback:()=>$e});function Nt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function $e(e,t=!1){let n=Nt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}async function xe(e,t={}){return new Promise((n,i)=>{let r=$e(h=>{n(h),Reflect.deleteProperty(window,`_${a}`)},!0),a=$e(h=>{i(h),Reflect.deleteProperty(window,`_${r}`)},!0);window.__TAURI_IPC__({cmd:e,callback:r,error:a,...t})})}function At(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var Pt={};at(Pt,{TauriEvent:()=>ft,emit:()=>ht,listen:()=>mt,once:()=>qt});async function Pe(e){return xe("tauri",e)}async function ut(e,t){return Pe({__tauriModule:"Event",message:{cmd:"unlisten",event:e,eventId:t}})}async function Rt(e,t,n){await Pe({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:n}})}async function dt(e,t,n){return Pe({__tauriModule:"Event",message:{cmd:"listen",event:e,windowLabel:t,handler:$e(n)}}).then(i=>async()=>ut(e,i))}async function Ht(e,t,n){return dt(e,t,i=>{n(i),ut(e,i.id).catch(()=>{})})}var ft=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(ft||{});async function mt(e,t){return dt(e,null,t)}async function qt(e,t){return Ht(e,null,t)}async function ht(e,t){return Rt(e,void 0,t)}function jt(e){let t,n,i,r,a,h,c,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),h=f("button"),h.textContent="Send event to Rust",l(n,"class","btn"),l(n,"id","log"),l(r,"class","btn"),l(r,"id","request"),l(h,"class","btn"),l(h,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,h),c||(u=[z(n,"click",e[0]),z(r,"click",e[1]),z(h,"click",e[2])],c=!0)},p:$,i:$,o:$,d(d){d&&w(t),c=!1,F(u)}}}function Ut(e,t,n){let{onMessage:i}=t,r;Ee(async()=>{r=await mt("rust-event",i)}),lt(()=>{r&&r()});function a(){xe("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function h(){xe("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){ht("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,h,c,i]}class zt extends Oe{constructor(t){super(),Le(this,t,Ut,jt,ue,{onMessage:3})}}function Ft(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
- `,l(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Vt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(c){const u=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=c,u.srcObject=c}function h(c){if(c.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return Ee(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(r);a(c)}catch(c){h(c)}}),lt(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class Bt extends Oe{constructor(t){super(),Le(this,t,Vt,Ft,ue,{onMessage:0})}}function Qe(e,t,n){const i=e.slice();return i[25]=t[n],i}function Ze(e,t,n){const i=e.slice();return i[28]=t[n],i}function Gt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Xt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Yt(e){let t,n;return{c(){t=K(`Switch to Dark mode - `),n=f("div"),l(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function Jt(e){let t,n;return{c(){t=K(`Switch to Light mode - `),n=f("div"),l(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function Kt(e){let t,n,i,r,a=e[28].label+"",h,c,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),h=K(a),l(n,"class",e[28].icon+" mr-2"),l(t,"href","##"),l(t,"class",c="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,O){k(v,t,O),o(t,n),o(t,i),o(t,r),o(r,h),u||(d=z(t,"click",E),u=!0)},p(v,O){e=v,O&2&&c!==(c="nv "+(e[1]===e[28]?"nv_selected":""))&&l(t,"class",c)},d(v){v&&w(t),u=!1,d()}}}function et(e){let t,n=e[28]&&Kt(e);return{c(){n&&n.c(),t=ot()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function tt(e){let t,n=e[25].html+"",i;return{c(){t=new Et(!1),i=ot(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function Qt(e){let t,n,i,r,a,h,c,u,d,E,v,O,R,S,Q,W,de,b,H,T,q,V,Z,ee,fe,me,p,_,C,I,N,te,j=e[1].label+"",Se,Re,he,ne,y,He,M,pe,qe,B,ge,je,ie,Ue,re,oe,De,ze;function Fe(s,D){return s[0]?Xt:Gt}let _e=Fe(e),A=_e(e);function Ve(s,D){return s[2]?Jt:Yt}let ve=Ve(e),P=ve(e),G=e[5],x=[];for(let s=0;s`,de=g(),b=f("a"),b.innerHTML=`GitHub - `,H=g(),T=f("a"),T.innerHTML=`Source - `,q=g(),V=f("br"),Z=g(),ee=f("div"),fe=g(),me=f("br"),p=g(),_=f("div");for(let s=0;s',Ue=g(),re=f("div");for(let s=0;s{Ae(m,1)}),St()}X?(y=new X(Be(s)),Ke(y.$$.fragment),Ie(y.$$.fragment,1),Ne(y,ne,null)):y=null}if(D&16){Y=s[4];let m;for(m=0;m{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),it(u)});function d(){n(2,u=!u),it(u)}let E=Tt([]);bt(e,E,p=>n(4,i=p));function v(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p,null,1))+"
"},..._])}function O(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+p+"
"},..._])}function R(){E.update(()=>[])}let S,Q,W;function de(p){W=p.clientY;const _=window.getComputedStyle(S);Q=parseInt(_.height,10);const C=N=>{const te=N.clientY-W,j=Q-te;n(3,S.style.height=`${j{document.removeEventListener("mouseup",I),document.removeEventListener("mousemove",C)};document.addEventListener("mouseup",I),document.addEventListener("mousemove",C)}let b=!1,H,T,q=!1,V=0,Z=0;const ee=(p,_,C)=>Math.min(Math.max(_,p),C);Ee(()=>{n(13,H=document.querySelector("#sidebar")),T=document.querySelector("#sidebarToggle"),document.addEventListener("click",p=>{T.contains(p.target)?n(0,b=!b):b&&!H.contains(p.target)&&n(0,b=!1)}),document.addEventListener("touchstart",p=>{if(T.contains(p.target))return;const _=p.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,V=_)}),document.addEventListener("touchmove",p=>{if(q){const _=p.touches[0].clientX;Z=_;const C=(_-V)/10;H.style.setProperty("--translate-x",`-${ee(0,b?0-C:18.75-C,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const p=(Z-V)/10;n(0,b=b?p>-(18.75/2):p>18.75/2)}q=!1})});const fe=p=>{c(p),n(0,b=!1)};function me(p){Ce[p?"unshift":"push"](()=>{S=p,n(3,S)})}return e.$$.update=()=>{if(e.$$.dirty&1){const p=document.querySelector("#sidebar");p&&Zt(p,b)}},[b,h,u,S,i,a,c,d,E,v,O,R,de,H,fe,me]}class tn extends Oe{constructor(t){super(),Le(this,t,en,Qt,ue,{})}}new tn({target:document.querySelector("#app")}); + tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={}){return new Promise((n,i)=>{let r=fe(m=>{n(m),Reflect.deleteProperty(window,`_${a}`)},!0),a=fe(m=>{i(m),Reflect.deleteProperty(window,`_${r}`)},!0);window.__TAURI_IPC__({cmd:e,callback:r,error:a,payload:t})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,m,c,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),m=f("button"),m.textContent="Send event to Rust",l(n,"class","btn"),l(n,"id","log"),l(r,"class","btn"),l(r,"id","request"),l(m,"class","btn"),l(m,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,m),c||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(m,"click",e[2])],c=!0)},p:$,i:$,o:$,d(d){d&&w(t),c=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function m(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,m,c,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ `,l(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(c){const u=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=c,u.srcObject=c}function m(c){if(c.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return xe(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(r);a(c)}catch(c){m(c)}}),at(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode + `),n=f("div"),l(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode + `),n=f("div"),l(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",m,c,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),m=Q(a),l(n,"class",e[28].icon+" mr-2"),l(t,"href","##"),l(t,"class",c="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,m),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&c!==(c="nv "+(e[1]===e[28]?"nv_selected":""))&&l(t,"class",c)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,m,c,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,p,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(s,T){return s[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(s,T){return s[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let s=0;s`,me=g(),b=f("a"),b.innerHTML=`GitHub + `,j=g(),C=f("a"),C.innerHTML=`Source + `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),p=g(),_=f("div");for(let s=0;s',ze=g(),oe=f("div");for(let s=0;s{Re(h,1)}),Dt()}Y?(y=new Y(Ge(s)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=s[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,p=>n(4,i=p));function v(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p,null,1))+"
"},..._])}function S(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+p+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(p){I=p.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const D=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",D)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",D)}let b=!1,j,C,q=!1,B=0,ee=0;const te=(p,_,D)=>Math.min(Math.max(_,p),D);xe(()=>{n(13,j=document.querySelector("#sidebar")),C=document.querySelector("#sidebarToggle"),document.addEventListener("click",p=>{C.contains(p.target)?n(0,b=!b):b&&!j.contains(p.target)&&n(0,b=!1)}),document.addEventListener("touchstart",p=>{if(C.contains(p.target))return;const _=p.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",p=>{if(q){const _=p.touches[0].clientX;ee=_;const D=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-D:18.75-D,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const p=(ee-B)/10;n(0,b=b?p>-(18.75/2):p>18.75/2)}q=!1})});const pe=p=>{c(p),n(0,b=!1)};function ge(p){Ne[p?"unshift":"push"](()=>{O=p,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const p=document.querySelector("#sidebar");p&&rn(p,b)}},[b,m,u,O,i,a,c,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 55ed3206fdc1..1635d3e39171 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -207,12 +207,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.2" @@ -1798,14 +1792,15 @@ dependencies = [ [[package]] name = "ndk" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags", "jni-sys", "ndk-sys", "num_enum", + "raw-window-handle", "thiserror", ] @@ -1817,9 +1812,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.3.0" +version = "0.4.1+23.1.7779620" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" dependencies = [ "jni-sys", ] @@ -2139,7 +2134,7 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ - "base64 0.21.2", + "base64", "indexmap", "line-wrap", "quick-xml", @@ -2405,7 +2400,7 @@ version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.2", + "base64", "bytes", "encoding_rs", "futures-core", @@ -2595,7 +2590,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" dependencies = [ - "base64 0.21.2", + "base64", "chrono", "hex", "indexmap", @@ -2793,7 +2788,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05e51d6f2b5fff4808614f429f8a7655ac8bcfe218185413f3a60c508482c2d6" dependencies = [ - "base64 0.21.2", + "base64", "serde", "serde_json", ] @@ -2835,9 +2830,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "746ae5d0ca57ae275a792f109f6e992e0b41a443abdf3f5c6eff179ef5b3443a" +checksum = "511428fc831c0b02629c7c160ecb07a4fec54fa7d95571d280c4fbd41779720a" dependencies = [ "bitflags", "cairo-rs", @@ -2877,8 +2872,8 @@ dependencies = [ "tao-macros", "unicode-segmentation", "uuid", - "windows 0.44.0", - "windows-implement", + "windows 0.48.0", + "windows-implement 0.48.0", "x11-dl", ] @@ -2944,7 +2939,7 @@ dependencies = [ "url", "uuid", "webkit2gtk", - "webview2-com", + "webview2-com 0.22.1", "windows 0.44.0", ] @@ -2971,7 +2966,7 @@ dependencies = [ name = "tauri-codegen" version = "2.0.0-alpha.5" dependencies = [ - "base64 0.21.2", + "base64", "brotli", "ico 0.3.0", "json-patch", @@ -3080,7 +3075,7 @@ dependencies = [ "tauri-utils", "uuid", "webkit2gtk", - "webview2-com", + "webview2-com 0.22.1", "windows 0.44.0", "wry", ] @@ -3686,10 +3681,23 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11296e5daf3a653b79bf47d66c380e4143d5b9c975818871179a3bda79499562" dependencies = [ - "webview2-com-macros", - "webview2-com-sys", + "webview2-com-macros 0.6.0", + "webview2-com-sys 0.22.1", "windows 0.44.0", - "windows-implement", + "windows-implement 0.44.0", +] + +[[package]] +name = "webview2-com" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e563ffe8e84d42e43ffacbace8780c0244fc8910346f334613559d92e203ad" +dependencies = [ + "webview2-com-macros 0.7.0", + "webview2-com-sys 0.25.0", + "windows 0.48.0", + "windows-implement 0.48.0", + "windows-interface 0.48.0", ] [[package]] @@ -3703,6 +3711,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "webview2-com-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.18", +] + [[package]] name = "webview2-com-sys" version = "0.22.1" @@ -3714,8 +3733,23 @@ dependencies = [ "serde_json", "thiserror", "windows 0.44.0", - "windows-bindgen", - "windows-metadata", + "windows-bindgen 0.44.0", + "windows-metadata 0.44.0", +] + +[[package]] +name = "webview2-com-sys" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d39576804304cf9ead192467ef47f7859a1a12fec3bd459d5ba34b8cd65ed5" +dependencies = [ + "regex", + "serde", + "serde_json", + "thiserror", + "windows 0.48.0", + "windows-bindgen 0.48.0", + "windows-metadata 0.48.0", ] [[package]] @@ -3767,8 +3801,8 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.44.0", + "windows-interface 0.44.0", "windows-targets 0.42.2", ] @@ -3778,6 +3812,8 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ + "windows-implement 0.48.0", + "windows-interface 0.48.0", "windows-targets 0.48.0", ] @@ -3787,8 +3823,18 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "222204ecf46521382a4d88b4a1bbefca9f8855697b4ab7d20803901425e061a3" dependencies = [ - "windows-metadata", - "windows-tokens", + "windows-metadata 0.44.0", + "windows-tokens 0.44.0", +] + +[[package]] +name = "windows-bindgen" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe21a77bc54b7312dbd66f041605e098990c98be48cd52967b85b5e60e75ae6" +dependencies = [ + "windows-metadata 0.48.0", + "windows-tokens 0.48.0", ] [[package]] @@ -3802,6 +3848,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "windows-implement" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "windows-interface" version = "0.44.0" @@ -3813,12 +3870,29 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "windows-interface" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "windows-metadata" version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee78911e3f4ce32c1ad9d3c7b0bd95389662ad8d8f1a3155688fed70bd96e2b6" +[[package]] +name = "windows-metadata" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ee0e5f0e2cc372bb6addbfff9a8add712155cd743df9c15f6ab000f31432d" + [[package]] name = "windows-sys" version = "0.42.0" @@ -3879,6 +3953,12 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa4251900975a0d10841c5d4bde79c56681543367ef811f3fabb8d1803b0959b" +[[package]] +name = "windows-tokens" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4" + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -3994,10 +4074,9 @@ dependencies = [ [[package]] name = "wry" version = "0.28.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d15f9f827d537cefe6d047be3930f5d89b238dfb85e08ba6a319153217635aa" +source = "git+https://github.com/tauri-apps/wry?branch=feat/android-protocol-req-body#ce8fc97db23ae74d7dc1234e6d6c85e4235c9e10" dependencies = [ - "base64 0.13.1", + "base64", "block", "cocoa", "core-graphics", @@ -4025,9 +4104,9 @@ dependencies = [ "url", "webkit2gtk", "webkit2gtk-sys", - "webview2-com", - "windows 0.44.0", - "windows-implement", + "webview2-com 0.25.0", + "windows 0.48.0", + "windows-implement 0.48.0", ] [[package]] diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index 94f1826a0834..36fc1e1141fd 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L163"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L163"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L98"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L98"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L136"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L136"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n switch (cmd) {\n case \"add\":\n return (args.a as number) + (args.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"args","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":73,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":74,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":75,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":76,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":73,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":79,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":80,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":81,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":82,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":78,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":77,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":83,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":84,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":86,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":87,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":88,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":89,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":90,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":91,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":92,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":93,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":94,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[74]},{"title":"Properties","children":[79,78,77]},{"title":"Accessors","children":[83]},{"title":"Methods","children":[93]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":95,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":96,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":97,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":98,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":99,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":100,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":101,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":104,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":103,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":102,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":105,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":106,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[97]},{"title":"Properties","children":[104,103,102]},{"title":"Methods","children":[105]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L82"}]},{"id":65,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L125"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":107,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":108,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":109,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":110,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":111,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":113,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":114,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":115,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":122,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":123,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":124,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":116,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":117,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":118,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":119,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":120,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":65,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":66,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":67,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":68,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":69,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":70,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":71,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":72,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[73,96]},{"title":"Type Aliases","children":[65]},{"title":"Functions","children":[107,121,116,66]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/6d3f3138b/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"args"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"65":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"66":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"67":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"68":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"69":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"70":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"71":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"72":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"73":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"74":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"75":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"76":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"77":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"78":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"79":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"80":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"81":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"82":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"83":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"84":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"85":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"86":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"87":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"88":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"89":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"90":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"91":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"92":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"93":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"94":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"95":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"96":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"97":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"98":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"99":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"100":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"101":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"102":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"103":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"104":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"105":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"106":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"107":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"108":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"109":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"110":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"111":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"112":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"113":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"114":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"115":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"116":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"117":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"118":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"119":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"120":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"121":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"122":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"123":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"124":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L163"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L163"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L98"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L98"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L136"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L136"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":73,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":74,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":75,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":76,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":73,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":79,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":80,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":81,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":82,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":78,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":77,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":83,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":84,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":86,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":87,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":88,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":89,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":90,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":91,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":92,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":93,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":94,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[74]},{"title":"Properties","children":[79,78,77]},{"title":"Accessors","children":[83]},{"title":"Methods","children":[93]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":95,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":96,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":97,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":98,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":99,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":100,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":101,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":104,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":103,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":102,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":105,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":106,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[97]},{"title":"Properties","children":[104,103,102]},{"title":"Methods","children":[105]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L82"}]},{"id":65,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L125"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":107,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":108,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":109,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":110,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":111,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":113,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":114,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":115,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":122,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":123,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":124,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":116,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":117,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":118,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":119,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":120,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":65,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":66,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":67,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":68,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":69,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":70,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":71,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":72,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[73,96]},{"title":"Type Aliases","children":[65]},{"title":"Functions","children":[107,121,116,66]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"65":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"66":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"67":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"68":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"69":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"70":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"71":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"72":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"73":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"74":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"75":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"76":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"77":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"78":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"79":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"80":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"81":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"82":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"83":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"84":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"85":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"86":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"87":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"88":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"89":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"90":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"91":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"92":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"93":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"94":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"95":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"96":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"97":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"98":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"99":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"100":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"101":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"102":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"103":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"104":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"105":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"106":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"107":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"108":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"109":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"110":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"111":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"112":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"113":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"114":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"115":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"116":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"117":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"118":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"119":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"120":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"121":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"122":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"123":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"124":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 217536d905cb..1dcaab3a45d1 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -190,7 +190,7 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { */ function convertFileSrc(filePath: string, protocol = 'asset'): string { const path = encodeURIComponent(filePath) - return navigator.userAgent.includes('Windows') + return navigator.userAgent.includes('Windows') || navigator.userAgent.includes('Android') ? `https://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}` } From d4ae4ca3cd78a56f146408bc315d991984d34925 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 10 Jun 2023 14:18:58 -0300 Subject: [PATCH 05/90] lint --- core/tauri/src/hooks.rs | 2 +- core/tauri/src/jni_helpers.rs | 4 ++-- core/tauri/src/plugin/mobile.rs | 6 +++--- core/tauri/src/window.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index c01b76edb4c9..b474c679a396 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -80,7 +80,7 @@ impl From> for InvokeBody { impl InvokeBody { #[cfg(mobile)] - pub(crate) fn to_json(self) -> JsonValue { + pub(crate) fn into_json(self) -> JsonValue { match self { Self::Json(v) => v, Self::Raw(v) => { diff --git a/core/tauri/src/jni_helpers.rs b/core/tauri/src/jni_helpers.rs index e6edb281077d..ae500fc5265a 100644 --- a/core/tauri/src/jni_helpers.rs +++ b/core/tauri/src/jni_helpers.rs @@ -31,7 +31,7 @@ fn json_to_java<'a, R: Runtime>( } JsonValue::String(val) => ( "Ljava/lang/Object;", - JObject::from(env.new_string(&val)?).into(), + JObject::from(env.new_string(val)?).into(), ), JsonValue::Array(val) => { let js_array_class = runtime_handle.find_class(env, activity, "app/tauri/plugin/JSArray")?; @@ -60,7 +60,7 @@ fn json_to_java<'a, R: Runtime>( data, "put", format!("(Ljava/lang/String;{signature})Lapp/tauri/plugin/JSObject;"), - &[env.new_string(&key)?.into(), val], + &[env.new_string(key)?.into(), val], )?; } diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 3f409a159af4..0f482b353112 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -248,7 +248,7 @@ impl PluginHandle { ) -> Result { let (tx, rx) = channel(); run_command( - &self.name, + self.name, &self.handle, command, serde_json::to_value(payload) @@ -321,7 +321,7 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + id, &name.into(), &command.as_ref().into(), - crate::ios::json_to_dictionary(&payload.to_json()) as _, + crate::ios::json_to_dictionary(&payload.into_json()) as _, crate::ios::PluginMessageCallback(plugin_command_response_handler), ); } @@ -386,7 +386,7 @@ pub(crate) fn run_command< let id: i32 = rand::random(); let plugin_name = name.to_string(); let command = command.as_ref().to_string(); - let payload = payload.to_json(); + let payload = payload.into_json(); let handle_ = handle.clone(); PENDING_PLUGIN_CALLS diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 506172a804c2..b049671acf99 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1766,7 +1766,7 @@ impl Window { if !handled { handled = true; crate::plugin::mobile::run_command( - &plugin, + plugin, &self.app_handle, message.command, message.payload, From 02e39d5f8ab91fbeed77e3a6e84bd69144302b0f Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 10 Jun 2023 14:39:36 -0300 Subject: [PATCH 06/90] fix tests [skip ci] --- core/tauri/src/hooks.rs | 6 ++++++ core/tauri/src/ios.rs | 6 +++--- core/tauri/src/scope/ipc.rs | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index b474c679a396..c52d54bf1347 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -66,6 +66,12 @@ pub enum InvokeBody { Raw(Vec), } +impl Default for InvokeBody { + fn default() -> Self { + Self::Json(Default::default()) + } +} + impl From for InvokeBody { fn from(value: JsonValue) -> Self { Self::Json(value) diff --git a/core/tauri/src/ios.rs b/core/tauri/src/ios.rs index dd7f5e5d6433..18cfc45aa17d 100644 --- a/core/tauri/src/ios.rs +++ b/core/tauri/src/ios.rs @@ -100,7 +100,7 @@ unsafe fn add_json_value_to_array(array: id, value: &JsonValue) { let () = msg_send![array, addObject: number]; } JsonValue::String(val) => { - let () = msg_send![array, addObject: NSString::new(&val)]; + let () = msg_send![array, addObject: NSString::new(val)]; } JsonValue::Array(val) => { let nsarray: id = msg_send![class!(NSMutableArray), alloc]; @@ -122,7 +122,7 @@ unsafe fn add_json_value_to_array(array: id, value: &JsonValue) { } unsafe fn add_json_entry_to_dictionary(data: id, key: &str, value: &JsonValue) { - let key = NSString::new(&key); + let key = NSString::new(key); match value { JsonValue::Null => { let null: id = msg_send![class!(NSNull), null]; @@ -146,7 +146,7 @@ unsafe fn add_json_entry_to_dictionary(data: id, key: &str, value: &JsonValue) { let () = msg_send![data, setObject:number forKey: key]; } JsonValue::String(val) => { - let () = msg_send![data, setObject:NSString::new(&val) forKey: key]; + let () = msg_send![data, setObject:NSString::new(val) forKey: key]; } JsonValue::Array(val) => { let nsarray: id = msg_send![class!(NSMutableArray), alloc]; diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index 9f655906fdf6..3e00e45d0844 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -236,7 +236,7 @@ mod tests { cmd: "plugin:path|is_absolute".into(), callback, error, - inner: serde_json::Value::Object(payload), + body: serde_json::Value::Object(payload).into(), } } @@ -248,7 +248,7 @@ mod tests { cmd: format!("plugin:{PLUGIN_NAME}|doSomething"), callback, error, - inner: Default::default(), + body: Default::default(), } } From 09c6d964ac94db185781877b1a3edb54d1a569dc Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 10:55:04 -0300 Subject: [PATCH 07/90] use current ipc on linux :( --- core/tauri-runtime-wry/src/lib.rs | 39 ++++++- core/tauri-runtime/src/webview.rs | 5 +- core/tauri-runtime/src/window.rs | 7 +- core/tauri-utils/src/pattern/isolation.js | 4 +- core/tauri/scripts/ipc-post-message.js | 38 ++---- core/tauri/scripts/ipc-protocol.js | 38 ++++++ core/tauri/src/app.rs | 35 ++++-- core/tauri/src/hooks.rs | 87 +++++++++----- core/tauri/src/manager.rs | 102 ++++++++++++++-- core/tauri/src/scope/ipc.rs | 62 ++++------ core/tauri/src/window.rs | 136 ++++++++++++---------- 11 files changed, 364 insertions(+), 189 deletions(-) create mode 100644 core/tauri/scripts/ipc-protocol.js diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 0021816f907a..65ab0ef3a352 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -7,9 +7,9 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle}; use tauri_runtime::{ http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse}, - menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuItem, MenuUpdate}, + menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate}, monitor::Monitor, - webview::{WindowBuilder, WindowBuilderBase}, + webview::{WebviewIpcHandler, WindowBuilder, WindowBuilderBase}, window::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, PendingWindow, WindowEvent, @@ -105,6 +105,7 @@ use std::{ }; pub type WebviewId = u64; +type IpcHandler = dyn Fn(&Window, String) + 'static; type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static; #[cfg(all(desktop, feature = "system-tray"))] pub use tauri_runtime::TrayId; @@ -3001,7 +3002,9 @@ fn create_webview( uri_scheme_protocols, mut window_builder, label, + ipc_handler, url, + menu_ids, #[cfg(target_os = "android")] on_webview_created, .. @@ -3078,6 +3081,15 @@ fn create_webview( }); } + if let Some(handler) = ipc_handler { + webview_builder = webview_builder.with_ipc_handler(create_ipc_handler( + context, + label.clone(), + menu_ids, + handler, + )); + } + for (scheme, protocol) in uri_scheme_protocols { webview_builder = webview_builder.with_custom_protocol(scheme, move |wry_request| { protocol(&HttpRequestWrapper::from(wry_request).0) @@ -3196,6 +3208,29 @@ fn create_webview( }) } +/// Create a wry ipc handler from a tauri ipc handler. +fn create_ipc_handler( + context: Context, + label: String, + menu_ids: Arc>>, + handler: WebviewIpcHandler>, +) -> Box { + Box::new(move |window, request| { + let window_id = context.webview_id_map.get(&window.id()).unwrap(); + handler( + DetachedWindow { + dispatcher: WryDispatcher { + window_id, + context: context.clone(), + }, + label: label.clone(), + menu_ids: menu_ids.clone(), + }, + request, + ); + }) +} + /// Create a wry file drop handler. fn create_file_drop_handler(window_event_listeners: WindowEventListeners) -> Box { Box::new(move |_window, event| { diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index e9dd69b66c5a..888c127f5806 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,7 +4,7 @@ //! Items specific to the [`Runtime`](crate::Runtime)'s webview. -use crate::{menu::Menu, Icon}; +use crate::{menu::Menu, window::DetachedWindow, Icon}; #[cfg(target_os = "macos")] use tauri_utils::TitleBarStyle; @@ -331,3 +331,6 @@ pub trait WindowBuilder: WindowBuilderBase { /// Gets the window menu. fn get_menu(&self) -> Option<&Menu>; } + +/// IPC handler. +pub type WebviewIpcHandler = Box, String) + Send>; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index c9522e1f0fd8..fbb7899f9b92 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -7,7 +7,7 @@ use crate::{ http::{Request as HttpRequest, Response as HttpResponse}, menu::{Menu, MenuEntry, MenuHash, MenuId}, - webview::WebviewAttributes, + webview::{WebviewAttributes, WebviewIpcHandler}, Dispatch, Runtime, UserEvent, WindowBuilder, }; use serde::{Deserialize, Deserializer, Serialize}; @@ -226,6 +226,9 @@ pub struct PendingWindow> { pub uri_scheme_protocols: HashMap>, + /// How to handle IPC calls on the webview window. + pub ipc_handler: Option>, + /// Maps runtime id to a string menu id. pub menu_ids: Arc>>, @@ -276,6 +279,7 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, + ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), @@ -307,6 +311,7 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, + ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 93f955fa2ca5..3b873ddf2c7f 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -102,9 +102,7 @@ } const { cmd, callback, error, payload } = data - - const encrypted = await encrypt(payload) - sendMessage({ cmd, callback, error, payload: encrypted }) + sendMessage({ cmd, callback, error, payload: await encrypt(payload) }) } window.addEventListener('message', payloadHandler, false) diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js index a63d34c5b1f1..9b8d5de1c7e7 100644 --- a/core/tauri/scripts/ipc-post-message.js +++ b/core/tauri/scripts/ipc-post-message.js @@ -3,35 +3,11 @@ // SPDX-License-Identifier: MIT (function () { -Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { - value: (message) => { - const { cmd, callback, error, payload } = message - const { contentType, data } = __RAW_process_ipc_message_fn__(payload) - fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { - method: 'POST', - body: data, - headers: { - 'Content-Type': contentType, - 'Tauri-Callback': callback, - 'Tauri-Error': error, - } - }).then((response) => { - const cb = response.ok ? callback : error - // we need to split here because on Android the content-type gets duplicated - switch ((response.headers.get('content-type') || '').split(',')[0]) { - case 'application/json': - return response.json().then((r) => [cb, r]) - case 'text/plain': - return response.text().then((r) => [cb, r]) - default: - return response.arrayBuffer().then((r) => [cb, r]) - } - }).then(([cb, data]) => { - if (window[`_${cb}`]) { - window[`_${cb}`](data) - } else { - console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) - } - }) - }}) + Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { + value: (message) => { + const { cmd, callback, error, payload } = message + const { data } = __RAW_process_ipc_message_fn__({ cmd, callback, error, ...payload }) + window.ipc.postMessage(data) + } + }) })() diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js new file mode 100644 index 000000000000..5c4023a0990c --- /dev/null +++ b/core/tauri/scripts/ipc-protocol.js @@ -0,0 +1,38 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +(function () { + Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { + value: (message) => { + const { cmd, callback, error, payload } = message + const { contentType, data } = __RAW_process_ipc_message_fn__(payload) + fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { + method: 'POST', + body: data, + headers: { + 'Content-Type': contentType, + 'Tauri-Callback': callback, + 'Tauri-Error': error, + } + }).then((response) => { + const cb = response.ok ? callback : error + // we need to split here because on Android the content-type gets duplicated + switch ((response.headers.get('content-type') || '').split(',')[0]) { + case 'application/json': + return response.json().then((r) => [cb, r]) + case 'text/plain': + return response.text().then((r) => [cb, r]) + default: + return response.arrayBuffer().then((r) => [cb, r]) + } + }).then(([cb, data]) => { + if (window[`_${cb}`]) { + window[`_${cb}`](data) + } else { + console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) + } + }) + } + }) +})() diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index f42af70d3447..5d25e051deac 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -8,9 +8,7 @@ pub(crate) mod tray; use crate::{ api::ipc::CallbackFn, command::{CommandArg, CommandItem}, - hooks::{ - window_invoke_responder, InvokeHandler, InvokeResponder, OnPageLoad, PageLoadPayload, SetupHook, - }, + hooks::{InvokeHandler, InvokeResponder, OnPageLoad, PageLoadPayload, SetupHook}, manager::{Asset, CustomProtocol, WindowManager}, plugin::{Plugin, PluginStore}, runtime::{ @@ -23,7 +21,6 @@ use crate::{ sealed::{ManagerBase, RuntimeOrDispatch}, utils::config::Config, utils::{assets::Assets, Env}, - window::IpcStore, Context, DeviceEventFilter, EventLoopMessage, Icon, Invoke, InvokeError, InvokeResponse, Manager, Runtime, Scopes, StateManager, Theme, Window, }; @@ -766,7 +763,7 @@ pub struct Builder { invoke_handler: Box>, /// The JS message responder. - invoke_responder: Arc>, + invoke_responder: Option>>, /// The script that initializes the `window.__TAURI_POST_MESSAGE__` function. invoke_initialization_script: String, @@ -814,9 +811,17 @@ pub struct Builder { device_event_filter: DeviceEventFilter, } +#[derive(Template)] +#[default_template("../scripts/ipc-protocol.js")] +struct ProtocolInvokeInitializationScript<'a> { + /// The function that processes the IPC message. + #[raw] + process_ipc_message_fn: &'a str, +} + #[derive(Template)] #[default_template("../scripts/ipc-post-message.js")] -struct InvokeInitializationScript<'a> { +struct PostMessageInvokeInitializationScript<'a> { /// The function that processes the IPC message. #[raw] process_ipc_message_fn: &'a str, @@ -830,8 +835,16 @@ impl Builder { runtime_any_thread: false, setup: Box::new(|_| Ok(())), invoke_handler: Box::new(|_| false), - invoke_responder: Arc::new(window_invoke_responder), - invoke_initialization_script: InvokeInitializationScript { + invoke_responder: None, + #[cfg(target_os = "linux")] + invoke_initialization_script: PostMessageInvokeInitializationScript { + process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, + } + .render_default(&Default::default()) + .unwrap() + .into_string(), + #[cfg(not(target_os = "linux"))] + invoke_initialization_script: ProtocolInvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, } .render_default(&Default::default()) @@ -899,10 +912,10 @@ impl Builder { #[must_use] pub fn invoke_system(mut self, initialization_script: String, responder: F) -> Self where - F: Fn(Window, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, + F: Fn(Window, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, { self.invoke_initialization_script = initialization_script; - self.invoke_responder = Arc::new(responder); + self.invoke_responder.replace(Arc::new(responder)); self } @@ -1346,8 +1359,6 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); - app.manage(IpcStore::default()); - #[cfg(windows)] { if let crate::utils::config::WebviewInstallMode::FixedRuntime { path } = &app diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index c52d54bf1347..650e05a61555 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -5,8 +5,7 @@ use crate::{ api::ipc::{CallbackFn, IpcResponse}, app::App, - window::{IpcKey, IpcStore}, - Manager, Runtime, StateManager, Window, + Runtime, StateManager, Window, }; use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; @@ -24,6 +23,8 @@ pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; /// A closure that is responsible for respond a JS message. pub type InvokeResponder = + dyn Fn(Window, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; +type OwnedInvokeResponder = dyn Fn(Window, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; /// A closure that is run once every time a window is created and loaded. @@ -58,7 +59,8 @@ impl PageLoadPayload { } /// Possible values of an IPC payload. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize)] +#[serde(untagged)] pub enum InvokeBody { /// Json payload. Json(JsonValue), @@ -85,7 +87,7 @@ impl From> for InvokeBody { } impl InvokeBody { - #[cfg(mobile)] + #[cfg(any(mobile, test))] pub(crate) fn into_json(self) -> JsonValue { match self { Self::Json(v) => v, @@ -111,7 +113,6 @@ pub struct InvokeRequest { /// The message and resolver given to a custom command. #[default_runtime(crate::Wry, wry)] -#[derive(Debug)] pub struct Invoke { /// The message passed. pub message: InvokeMessage, @@ -184,9 +185,9 @@ impl From for InvokeResponse { /// Resolver of a invoke message. #[default_runtime(crate::Wry, wry)] -#[derive(Debug)] pub struct InvokeResolver { window: Window, + responder: Arc>, pub(crate) callback: CallbackFn, pub(crate) error: CallbackFn, } @@ -195,6 +196,7 @@ impl Clone for InvokeResolver { fn clone(&self) -> Self { Self { window: self.window.clone(), + responder: self.responder.clone(), callback: self.callback, error: self.error, } @@ -202,9 +204,15 @@ impl Clone for InvokeResolver { } impl InvokeResolver { - pub(crate) fn new(window: Window, callback: CallbackFn, error: CallbackFn) -> Self { + pub(crate) fn new( + window: Window, + responder: Arc>, + callback: CallbackFn, + error: CallbackFn, + ) -> Self { Self { window, + responder, callback, error, } @@ -217,7 +225,7 @@ impl InvokeResolver { F: Future> + Send + 'static, { crate::async_runtime::spawn(async move { - Self::return_task(self.window, task, self.callback, self.error).await; + Self::return_task(self.window, self.responder, task, self.callback, self.error).await; }); } @@ -231,13 +239,25 @@ impl InvokeResolver { Ok(ok) => InvokeResponse::Ok(ok), Err(err) => InvokeResponse::Err(err), }; - Self::return_result(self.window, response, self.callback, self.error) + Self::return_result( + self.window, + self.responder, + response, + self.callback, + self.error, + ) }); } /// Reply to the invoke promise with a serializable value. pub fn respond(self, value: Result) { - Self::return_result(self.window, value.into(), self.callback, self.error) + Self::return_result( + self.window, + self.responder, + value.into(), + self.callback, + self.error, + ) } /// Resolve the invoke promise with a value. @@ -249,6 +269,7 @@ impl InvokeResolver { pub fn reject(self, value: T) { Self::return_result( self.window, + self.responder, Result::<(), _>::Err(value).into(), self.callback, self.error, @@ -257,7 +278,13 @@ impl InvokeResolver { /// Reject the invoke promise with an [`InvokeError`]. pub fn invoke_error(self, error: InvokeError) { - Self::return_result(self.window, error.into(), self.callback, self.error) + Self::return_result( + self.window, + self.responder, + error.into(), + self.callback, + self.error, + ) } /// Asynchronously executes the given task @@ -267,6 +294,7 @@ impl InvokeResolver { /// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. pub async fn return_task( window: Window, + responder: Arc>, task: F, success_callback: CallbackFn, error_callback: CallbackFn, @@ -275,42 +303,39 @@ impl InvokeResolver { F: Future> + Send + 'static, { let result = task.await; - Self::return_closure(window, || result, success_callback, error_callback) + Self::return_closure( + window, + responder, + || result, + success_callback, + error_callback, + ) } pub(crate) fn return_closure Result>( window: Window, + responder: Arc>, f: F, success_callback: CallbackFn, error_callback: CallbackFn, ) { - Self::return_result(window, f().into(), success_callback, error_callback) + Self::return_result( + window, + responder, + f().into(), + success_callback, + error_callback, + ) } pub(crate) fn return_result( window: Window, + responder: Arc>, response: InvokeResponse, success_callback: CallbackFn, error_callback: CallbackFn, ) { - (window.invoke_responder())(window, response, success_callback, error_callback); - } -} - -pub fn window_invoke_responder( - window: Window, - response: InvokeResponse, - callback: CallbackFn, - error: CallbackFn, -) { - if let Some(tx) = window - .state::() - .0 - .lock() - .unwrap() - .remove(&IpcKey { callback, error }) - { - tx.send(response).unwrap(); + (responder)(window, response, success_callback, error_callback); } } diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index d26bd4a581c9..c52246c1bc67 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -45,7 +45,7 @@ use crate::{ MimeType, Request as HttpRequest, Response as HttpResponse, ResponseBuilder as HttpResponseBuilder, }, - webview::WindowBuilder, + webview::{WebviewIpcHandler, WindowBuilder}, window::{dpi::PhysicalSize, DetachedWindow, FileDropEvent, PendingWindow}, }, utils::{ @@ -239,7 +239,7 @@ pub struct InnerWindowManager { /// Window event listeners to all windows. window_event_listeners: Arc>>, /// Responder for invoke calls. - invoke_responder: Arc>, + invoke_responder: Option>>, /// The script that initializes the invoke system. invoke_initialization_script: String, /// Application pattern. @@ -312,7 +312,7 @@ impl WindowManager { state: StateManager, window_event_listeners: Vec>, (menu, menu_event_listeners): (Option, Vec>), - (invoke_responder, invoke_initialization_script): (Arc>, String), + (invoke_responder, invoke_initialization_script): (Option>>, String), ) -> Self { // generate a random isolation key at runtime #[cfg(feature = "isolation")] @@ -363,7 +363,7 @@ impl WindowManager { } /// The invoke responder. - pub(crate) fn invoke_responder(&self) -> Arc> { + pub(crate) fn invoke_responder(&self) -> Option>> { self.inner.invoke_responder.clone() } @@ -581,6 +581,12 @@ impl WindowManager { Ok(pending) } + #[cfg(target_os = "linux")] + fn prepare_ipc_message_handler(&self) -> WebviewIpcHandler { + let manager = self.clone(); + Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) + } + fn prepare_ipc_scheme_protocol(&self, label: String) -> UriSchemeProtocolHandler { let manager = self.clone(); Box::new(move |request| { @@ -664,7 +670,7 @@ impl WindowManager { let asset_response = assets .get(&path.as_str().into()) .or_else(|| { - eprintln!("Asset `{path}` not found; fallback to {path}.html"); + debug_eprintln!("Asset `{path}` not found; fallback to {path}.html"); let fallback = format!("{}.html", path.as_str()).into(); let asset = assets.get(&fallback); asset_path = fallback; @@ -954,7 +960,7 @@ mod test { StateManager::new(), Default::default(), Default::default(), - (std::sync::Arc::new(|_, _, _, _| ()), "".into()), + (None, "".into()), ); #[cfg(custom_protocol)] @@ -1120,6 +1126,10 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; + #[cfg(target_os = "linux")] + { + pending.ipc_handler = Some(self.prepare_ipc_message_handler()); + } // in `Windows`, we need to force a data_directory // but we do respect user-specification @@ -1456,6 +1466,83 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } +#[allow(unused_mut)] +fn handle_ipc_message(mut message: String, manager: &WindowManager, label: &str) { + if let Some(window) = manager.get_window(label) { + #[derive(serde::Deserialize)] + struct Message { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: serde_json::Value, + } + + let mut invoke_message: Option> = None; + + #[cfg(feature = "isolation")] + { + #[cfg(target_os = "linux")] + { + #[derive(serde::Deserialize)] + struct IsolationMessage<'a> { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: RawIsolationPayload<'a>, + } + + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + invoke_message.replace( + serde_json::from_str::>(&message) + .map_err(Into::into) + .and_then(|message| { + Ok(Message { + cmd: message.cmd, + callback: message.callback, + error: message.error, + payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, + }) + }), + ); + } + } + + #[cfg(not(target_os = "linux"))] + { + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + invoke_message.replace( + RawIsolationPayload::try_from(message.as_str()) + .map_err(crate::Error::from) + .and_then(|raw| crypto_keys.decrypt(raw).map_err(Into::into)) + .and_then(|v| serde_json::from_slice(&v).map_err(Into::into)), + ); + } + } + } + + match invoke_message + .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) + { + Ok(message) => { + let _ = window.on_message(InvokeRequest { + cmd: message.cmd, + callback: message.callback, + error: message.error, + body: message.payload.into(), + }); + } + Err(e) => { + let _ = window.eval(&format!( + r#"console.error({})"#, + serde_json::Value::String(e.to_string()) + )); + } + } + } +} + fn handle_ipc_request( request: &HttpRequest, manager: &WindowManager, @@ -1529,7 +1616,8 @@ fn handle_ipc_request( body, }; - window.on_message(payload) + let rx = window.on_message(payload); + Ok(rx.recv().unwrap()) } else { Err("window not found".into()) } diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index 3e00e45d0844..138531f06b8e 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -169,7 +169,9 @@ mod tests { use serde::Serialize; use super::RemoteDomainAccessScope; - use crate::{api::ipc::CallbackFn, test::MockRuntime, App, InvokeRequest, Manager, Window}; + use crate::{ + api::ipc::CallbackFn, test::MockRuntime, App, InvokeRequest, InvokeResponse, Manager, Window, + }; const PLUGIN_NAME: &str = "test"; @@ -187,39 +189,19 @@ mod tests { fn assert_ipc_response( window: &Window, payload: InvokeRequest, - expected: Result, + expected: Result, ) { - let callback = payload.callback; - let error = payload.error; - window.clone().on_message(payload).unwrap(); - - let mut num_tries = 0; - let evaluated_script = loop { - std::thread::sleep(std::time::Duration::from_millis(50)); - let evaluated_script = window.dispatcher().last_evaluated_script(); - if let Some(s) = evaluated_script { - break s; - } - num_tries += 1; - if num_tries == 20 { - panic!("Response script not evaluated"); - } - }; - let (expected_response, fn_name) = match expected { - Ok(payload) => (serde_json::to_value(payload).unwrap(), callback), - Err(payload) => (serde_json::to_value(payload).unwrap(), error), - }; - let expected = format!( - "window[\"_{}\"]({})", - fn_name.0, - crate::api::ipc::serialize_js(&expected_response).unwrap() + let rx = window.clone().on_message(payload); + let response = rx.recv().unwrap(); + assert_eq!( + match response { + InvokeResponse::Ok(b) => Ok(b.into_json()), + InvokeResponse::Err(e) => Err(e.0), + }, + expected + .map(|e| serde_json::to_value(e).unwrap()) + .map_err(|e| serde_json::to_value(e).unwrap()) ); - - println!("Last evaluated script:"); - println!("{evaluated_script}"); - println!("Expected:"); - println!("{expected}"); - assert!(evaluated_script.contains(&expected)); } fn path_is_absolute_payload() -> InvokeRequest { @@ -259,7 +241,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_not_found_error_message( @@ -276,7 +258,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_window_error_message("main")), @@ -290,7 +272,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_domain_error_message( @@ -314,7 +296,7 @@ mod tests { assert_ipc_response(&window, path_is_absolute_payload(), Ok(true)); window.navigate("https://blog.tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_domain_error_message( @@ -327,7 +309,7 @@ mod tests { window.window.label = "test".into(); window.navigate("https://dev.tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_not_found_error_message( @@ -354,7 +336,7 @@ mod tests { ]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(crate::window::IPC_SCOPE_DOES_NOT_ALLOW), @@ -368,7 +350,7 @@ mod tests { .add_plugin(PLUGIN_NAME)]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, plugin_test_request(), Err(&format!("plugin {PLUGIN_NAME} not found")), @@ -382,7 +364,7 @@ mod tests { ]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, plugin_test_request(), Err(crate::window::IPC_SCOPE_DOES_NOT_ALLOW), diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index b049671acf99..eb95dcc8727d 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -17,7 +17,7 @@ use crate::{ app::AppHandle, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, - hooks::{InvokeBody, InvokeRequest, InvokeResponder}, + hooks::{InvokeBody, InvokeRequest}, manager::WindowManager, runtime::{ http::{Request as HttpRequest, Response as HttpResponse}, @@ -33,7 +33,7 @@ use crate::{ sealed::RuntimeOrDispatch, utils::config::{WindowConfig, WindowEffectsConfig, WindowUrl}, EventLoopMessage, Invoke, InvokeError, InvokeMessage, InvokeResolver, InvokeResponse, Manager, - PageLoadPayload, Runtime, Theme, WindowEvent, + Runtime, Theme, WindowEvent, }; #[cfg(desktop)] use crate::{ @@ -57,7 +57,7 @@ use std::{ hash::{Hash, Hasher}, path::PathBuf, sync::{ - mpsc::{channel, Sender}, + mpsc::{sync_channel, Receiver}, Arc, Mutex, }, }; @@ -67,22 +67,6 @@ pub(crate) type NavigationHandler = dyn Fn(Url) -> bool + Send; pub(crate) type UriSchemeProtocolHandler = Box Result> + Send + Sync>; -#[derive(Eq, PartialEq)] -pub(crate) struct IpcKey { - pub callback: CallbackFn, - pub error: CallbackFn, -} - -impl Hash for IpcKey { - fn hash(&self, state: &mut H) { - self.callback.hash(state); - self.error.hash(state); - } -} - -#[derive(Default)] -pub(crate) struct IpcStore(pub(crate) Mutex>>); - #[derive(Clone, Serialize)] struct WindowCreatedEvent { label: String, @@ -986,10 +970,6 @@ impl Window { WindowBuilder::<'a, R>::new(manager, label.into(), url) } - pub(crate) fn invoke_responder(&self) -> Arc> { - self.manager.invoke_responder() - } - /// The current window's dispatcher. pub(crate) fn dispatcher(&self) -> R::Dispatcher { self.window.dispatcher.clone() @@ -1675,7 +1655,7 @@ impl Window { } /// Handles this window receiving an [`InvokeRequest`] and returns the [`InvokeResponse`]. - pub fn on_message(self, request: InvokeRequest) -> Result { + pub fn on_message(self, request: InvokeRequest) -> Receiver { let manager = self.manager.clone(); let current_url = self.url(); let config_url = manager.get_url(); @@ -1700,41 +1680,73 @@ impl Window { } } }; + + let (tx, rx) = sync_channel(1); + + let custom_responder = self.manager.invoke_responder(); + + let resolver = InvokeResolver::new( + self.clone(), + Arc::new( + #[allow(unused_variables)] + move |window, response, callback, error| { + #[cfg(target_os = "linux")] + { + if custom_responder.is_none() { + let response_js = match crate::api::ipc::format_callback_result( + match &response { + InvokeResponse::Ok(v) => Ok(v), + InvokeResponse::Err(e) => Err(&e.0), + }, + callback, + error, + ) { + Ok(response_js) => response_js, + Err(e) => crate::api::ipc::format_callback(error, &e.to_string()) + .expect("unable to serialize response error string to json"), + }; + + let _ = window.eval(&response_js); + } + } + + if let Some(responder) = &custom_responder { + (responder)(window, &response, callback, error); + } + + tx.send(response).unwrap(); + }, + ), + request.callback, + request.error, + ); + match request.cmd.as_str() { "__initialized" => { - let payload: PageLoadPayload = match request.body { - InvokeBody::Json(v) => serde_json::from_value(v).map_err(|e| e.to_string())?, - InvokeBody::Raw(v) => serde_json::from_slice(&v).map_err(|e| e.to_string())?, + let parsed_payload = match request.body { + InvokeBody::Json(v) => serde_json::from_value(v), + InvokeBody::Raw(v) => serde_json::from_slice(&v), }; - manager.run_on_page_load(self, payload); - Ok(InvokeResponse::Ok(Vec::new().into())) + match parsed_payload { + Ok(payload) => { + manager.run_on_page_load(self, payload); + resolver.resolve(()); + } + Err(e) => resolver.reject(e.to_string()), + } } _ => { - let message = InvokeMessage::new( - self.clone(), - manager.state(), - request.cmd.to_string(), - request.body, - ); - let resolver = InvokeResolver::new(self.clone(), request.callback, request.error); - - let mut invoke = Invoke { message, resolver }; - - let (tx, rx) = channel(); - self.state::().0.lock().unwrap().insert( - IpcKey { - callback: request.callback, - error: request.error, - }, - #[allow(clippy::redundant_clone)] - tx.clone(), - ); + let message = + InvokeMessage::new(self, manager.state(), request.cmd.to_string(), request.body); - if !is_local && scope.is_none() { - return Err(scope_not_found_error_message); - } + let mut invoke = Invoke { + message, + resolver: resolver.clone(), + }; - if request.cmd.starts_with("plugin:") { + if !is_local && scope.is_none() { + invoke.resolver.reject(scope_not_found_error_message); + } else if request.cmd.starts_with("plugin:") { if !is_local { let command = invoke.message.command.replace("plugin:", ""); let plugin_name = command.split('|').next().unwrap().to_string(); @@ -1742,7 +1754,8 @@ impl Window { .map(|s| s.plugins().contains(&plugin_name)) .unwrap_or(true) { - return Err(IPC_SCOPE_DOES_NOT_ALLOW.into()); + invoke.resolver.reject(IPC_SCOPE_DOES_NOT_ALLOW); + return rx; } } let command = invoke.message.command.replace("plugin:", ""); @@ -1755,6 +1768,7 @@ impl Window { .unwrap_or_else(String::new); let command = invoke.message.command.clone(); + #[cfg(mobile)] let message = invoke.message.clone(); @@ -1765,7 +1779,7 @@ impl Window { { if !handled { handled = true; - crate::plugin::mobile::run_command( + if let Err(e) = crate::plugin::mobile::run_command( plugin, &self.app_handle, message.command, @@ -1773,26 +1787,26 @@ impl Window { move |response| { tx.send(response.into()).unwrap(); }, - ) - .map_err(|e| e.to_string())?; + ) { + resolver.reject(e); + } } } if !handled { - return Err(format!("Command {command} not found")); + resolver.reject(format!("Command {command} not found")); } } else { let command = invoke.message.command.clone(); let handled = manager.run_invoke_handler(invoke); if !handled { - return Err(format!("Command {command} not found")); + resolver.reject(format!("Command {command} not found")); } } - - let response = rx.recv().unwrap(); - Ok(response) } } + + rx } /// Evaluates JavaScript on this window. From 6cbba9ced931fcd9572ef69dbe1209b0dde8cd94 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 10:57:19 -0300 Subject: [PATCH 08/90] simplify cfg --- core/tauri/src/manager.rs | 60 +++++++++++++++------------------------ 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index c52246c1bc67..90ef45374c6d 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -1466,8 +1466,8 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } -#[allow(unused_mut)] -fn handle_ipc_message(mut message: String, manager: &WindowManager, label: &str) { +#[cfg(target_os = "linux")] +fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { if let Some(window) = manager.get_window(label) { #[derive(serde::Deserialize)] struct Message { @@ -1478,47 +1478,33 @@ fn handle_ipc_message(mut message: String, manager: &WindowManager> = None; #[cfg(feature = "isolation")] { - #[cfg(target_os = "linux")] - { - #[derive(serde::Deserialize)] - struct IsolationMessage<'a> { - cmd: String, - callback: CallbackFn, - error: CallbackFn, - #[serde(flatten)] - payload: RawIsolationPayload<'a>, - } - - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - invoke_message.replace( - serde_json::from_str::>(&message) - .map_err(Into::into) - .and_then(|message| { - Ok(Message { - cmd: message.cmd, - callback: message.callback, - error: message.error, - payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, - }) - }), - ); - } + #[derive(serde::Deserialize)] + struct IsolationMessage<'a> { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: RawIsolationPayload<'a>, } - #[cfg(not(target_os = "linux"))] - { - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - invoke_message.replace( - RawIsolationPayload::try_from(message.as_str()) - .map_err(crate::Error::from) - .and_then(|raw| crypto_keys.decrypt(raw).map_err(Into::into)) - .and_then(|v| serde_json::from_slice(&v).map_err(Into::into)), - ); - } + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + invoke_message.replace( + serde_json::from_str::>(&message) + .map_err(Into::into) + .and_then(|message| { + Ok(Message { + cmd: message.cmd, + callback: message.callback, + error: message.error, + payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, + }) + }), + ); } } From 82153f28536c220b1ab86f1b0915cf5237c796aa Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 14:52:29 -0300 Subject: [PATCH 09/90] fix mobile build --- core/tauri/src/manager.rs | 6 ++++-- core/tauri/src/window.rs | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 90ef45374c6d..9adc9c97ce77 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -45,7 +45,7 @@ use crate::{ MimeType, Request as HttpRequest, Response as HttpResponse, ResponseBuilder as HttpResponseBuilder, }, - webview::{WebviewIpcHandler, WindowBuilder}, + webview::WindowBuilder, window::{dpi::PhysicalSize, DetachedWindow, FileDropEvent, PendingWindow}, }, utils::{ @@ -582,7 +582,9 @@ impl WindowManager { } #[cfg(target_os = "linux")] - fn prepare_ipc_message_handler(&self) -> WebviewIpcHandler { + fn prepare_ipc_message_handler( + &self, + ) -> crate::runtime::webview::WebviewIpcHandler { let manager = self.clone(); Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index eb95dcc8727d..2ad6c1ea27b4 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1682,6 +1682,8 @@ impl Window { }; let (tx, rx) = sync_channel(1); + #[cfg(mobile)] + let tx_ = tx.clone(); let custom_responder = self.manager.invoke_responder(); @@ -1736,6 +1738,9 @@ impl Window { } } _ => { + #[cfg(mobile)] + let app_handle = self.app_handle.clone(); + let message = InvokeMessage::new(self, manager.state(), request.cmd.to_string(), request.body); @@ -1781,14 +1786,15 @@ impl Window { handled = true; if let Err(e) = crate::plugin::mobile::run_command( plugin, - &self.app_handle, + &app_handle, message.command, message.payload, move |response| { - tx.send(response.into()).unwrap(); + tx_.send(response.into()).unwrap(); }, ) { - resolver.reject(e); + resolver.reject(e.to_string()); + return rx; } } } From 868bef064bde1f8a18ca95c160e053533c0f0164 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 14:54:38 -0300 Subject: [PATCH 10/90] api format --- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 3 ++- tooling/api/typedoc.json | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index 36fc1e1141fd..0c273109bb00 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L163"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L163"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L98"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L98"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L136"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L136"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":73,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":74,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":75,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":76,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":73,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":79,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":80,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":81,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":82,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":78,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":77,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":83,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":84,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":85,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":86,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":87,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":88,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":89,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":90,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":91,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":92,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":93,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":94,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[74]},{"title":"Properties","children":[79,78,77]},{"title":"Accessors","children":[83]},{"title":"Methods","children":[93]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":95,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":96,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":97,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":98,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":99,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":100,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":101,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":104,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":103,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":102,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":105,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":106,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[97]},{"title":"Properties","children":[104,103,102]},{"title":"Methods","children":[105]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L82"}]},{"id":65,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L125"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":107,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":108,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":109,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":110,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":111,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":113,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":114,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":115,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":96,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":122,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":123,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":124,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":116,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":117,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":118,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":119,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":120,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":65,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":66,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":67,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":68,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":69,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":70,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":71,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":72,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[73,96]},{"title":"Type Aliases","children":[65]},{"title":"Functions","children":[107,121,116,66]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/a6cbb21bd/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"65":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"66":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"67":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"68":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"69":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"70":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"71":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"72":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"73":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"74":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"75":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"76":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"77":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"78":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"79":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"80":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"81":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"82":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"83":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"84":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"85":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"86":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"87":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"88":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"89":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"90":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"91":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"92":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"93":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"94":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"95":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"96":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"97":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"98":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"99":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"100":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"101":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"102":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"103":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"104":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"105":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"106":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"107":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"108":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"109":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"110":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"111":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"112":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"113":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"114":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"115":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"116":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"117":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"118":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"119":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"120":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"121":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"122":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"123":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"124":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":163,"character":15}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":163,"character":0}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":98,"character":15}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":98,"character":0}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":136,"character":15}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event from the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":136,"character":0}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6},{"fileName":"tauri.ts","line":73,"character":6}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 1dcaab3a45d1..85e895005e04 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -190,7 +190,8 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { */ function convertFileSrc(filePath: string, protocol = 'asset'): string { const path = encodeURIComponent(filePath) - return navigator.userAgent.includes('Windows') || navigator.userAgent.includes('Android') + return navigator.userAgent.includes('Windows') || + navigator.userAgent.includes('Android') ? `https://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}` } diff --git a/tooling/api/typedoc.json b/tooling/api/typedoc.json index b10750659109..844f6065f09e 100644 --- a/tooling/api/typedoc.json +++ b/tooling/api/typedoc.json @@ -2,8 +2,8 @@ "entryPoints": [ "src/event.ts", "src/mocks.ts", - "src/tauri.ts", - "src/window.ts" + "src/path.ts", + "src/tauri.ts" ], "githubPages": false, "readme": "none", From 431cf07f4432d21008aca1d432f8aeb8a9a93dfb Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 15:10:47 -0300 Subject: [PATCH 11/90] fix windows build --- core/tauri-runtime-wry/Cargo.toml | 4 +- core/tauri-runtime-wry/src/lib.rs | 29 +++--- core/tauri-runtime/Cargo.toml | 2 +- core/tauri-utils/Cargo.toml | 2 +- core/tauri/Cargo.toml | 4 +- examples/api/src-tauri/Cargo.lock | 164 +++++------------------------- 6 files changed, 50 insertions(+), 155 deletions(-) diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index a57655e0c586..25ee92bfe069 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -23,10 +23,10 @@ rand = "0.8" raw-window-handle = "0.5" [target."cfg(windows)".dependencies] -webview2-com = "0.22" +webview2-com = "0.25" [target."cfg(windows)".dependencies.windows] - version = "0.44" + version = "0.48" features = [ "Win32_Foundation" ] [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 65ab0ef3a352..629e72c91c6b 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -3021,6 +3021,8 @@ fn create_webview( #[cfg(windows)] let window_theme = window_builder.inner.window.preferred_theme; + #[cfg(windows)] + let proxy = context.proxy.clone(); #[cfg(target_os = "macos")] { @@ -3068,17 +3070,18 @@ fn create_webview( } #[cfg(windows)] - if let Some(additional_browser_args) = webview_attributes.additional_browser_args { - webview_builder = webview_builder.with_additional_browser_args(&additional_browser_args); - } + { + if let Some(additional_browser_args) = webview_attributes.additional_browser_args { + webview_builder = webview_builder.with_additional_browser_args(&additional_browser_args); + } - #[cfg(windows)] - if let Some(theme) = window_theme { - webview_builder = webview_builder.with_theme(match theme { - WryTheme::Dark => wry::webview::Theme::Dark, - WryTheme::Light => wry::webview::Theme::Light, - _ => wry::webview::Theme::Light, - }); + if let Some(theme) = window_theme { + webview_builder = webview_builder.with_theme(match theme { + WryTheme::Dark => wry::webview::Theme::Dark, + WryTheme::Light => wry::webview::Theme::Light, + _ => wry::webview::Theme::Light, + }); + } } if let Some(handler) = ipc_handler { @@ -3161,12 +3164,12 @@ fn create_webview( #[cfg(windows)] { let controller = webview.controller(); - let proxy_ = context.proxy.clone(); + let proxy_ = proxy.clone(); let mut token = EventRegistrationToken::default(); unsafe { controller.add_GotFocus( &FocusChangedEventHandler::create(Box::new(move |_, _| { - let _ = proxy_.send_event(Message::Webview( + let _ = proxy.send_event(Message::Webview( window_id, WebviewMessage::WebviewEvent(WebviewEvent::Focused(true)), )); @@ -3179,7 +3182,7 @@ fn create_webview( unsafe { controller.add_LostFocus( &FocusChangedEventHandler::create(Box::new(move |_, _| { - let _ = proxy.send_event(Message::Webview( + let _ = proxy_.send_event(Message::Webview( window_id, WebviewMessage::WebviewEvent(WebviewEvent::Focused(false)), )); diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index c9b16271d2ad..1f8c70003123 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -37,7 +37,7 @@ rand = "0.8" url = { version = "2" } [target."cfg(windows)".dependencies.windows] -version = "0.44" +version = "0.48" features = [ "Win32_Foundation" ] [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index dda6ad6dcaa3..fbafda755039 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -44,7 +44,7 @@ infer = "0.12" heck = "0.4" [target."cfg(windows)".dependencies.windows] -version = "0.44.0" +version = "0.48.0" features = [ "implement", "Win32_Foundation", diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 9e16251409eb..839dc1e6cd57 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -81,10 +81,10 @@ cocoa = "0.24" objc = "0.2" [target."cfg(windows)".dependencies] -webview2-com = "0.22" +webview2-com = "0.25" [target."cfg(windows)".dependencies.windows] - version = "0.44" + version = "0.48" features = [ "Win32_Foundation" ] [target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies] diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 1635d3e39171..e33e6f79ad12 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -1046,7 +1046,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows 0.48.0", + "windows", ] [[package]] @@ -1384,7 +1384,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows", ] [[package]] @@ -2003,7 +2003,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.0", + "windows-targets", ] [[package]] @@ -2872,8 +2872,8 @@ dependencies = [ "tao-macros", "unicode-segmentation", "uuid", - "windows 0.48.0", - "windows-implement 0.48.0", + "windows", + "windows-implement", "x11-dl", ] @@ -2939,8 +2939,8 @@ dependencies = [ "url", "uuid", "webkit2gtk", - "webview2-com 0.22.1", - "windows 0.44.0", + "webview2-com", + "windows", ] [[package]] @@ -3058,7 +3058,7 @@ dependencies = [ "thiserror", "url", "uuid", - "windows 0.44.0", + "windows", ] [[package]] @@ -3075,8 +3075,8 @@ dependencies = [ "tauri-utils", "uuid", "webkit2gtk", - "webview2-com 0.22.1", - "windows 0.44.0", + "webview2-com", + "windows", "wry", ] @@ -3106,7 +3106,7 @@ dependencies = [ "thiserror", "url", "walkdir", - "windows 0.44.0", + "windows", ] [[package]] @@ -3675,40 +3675,17 @@ dependencies = [ "system-deps", ] -[[package]] -name = "webview2-com" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11296e5daf3a653b79bf47d66c380e4143d5b9c975818871179a3bda79499562" -dependencies = [ - "webview2-com-macros 0.6.0", - "webview2-com-sys 0.22.1", - "windows 0.44.0", - "windows-implement 0.44.0", -] - [[package]] name = "webview2-com" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79e563ffe8e84d42e43ffacbace8780c0244fc8910346f334613559d92e203ad" dependencies = [ - "webview2-com-macros 0.7.0", - "webview2-com-sys 0.25.0", - "windows 0.48.0", - "windows-implement 0.48.0", - "windows-interface 0.48.0", -] - -[[package]] -name = "webview2-com-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "webview2-com-macros", + "webview2-com-sys", + "windows", + "windows-implement", + "windows-interface", ] [[package]] @@ -3722,21 +3699,6 @@ dependencies = [ "syn 2.0.18", ] -[[package]] -name = "webview2-com-sys" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde542bed28058a5b028d459689ee57f1d06685bb6c266da3b91b1be6703952f" -dependencies = [ - "regex", - "serde", - "serde_json", - "thiserror", - "windows 0.44.0", - "windows-bindgen 0.44.0", - "windows-metadata 0.44.0", -] - [[package]] name = "webview2-com-sys" version = "0.25.0" @@ -3747,9 +3709,9 @@ dependencies = [ "serde", "serde_json", "thiserror", - "windows 0.48.0", - "windows-bindgen 0.48.0", - "windows-metadata 0.48.0", + "windows", + "windows-bindgen", + "windows-metadata", ] [[package]] @@ -3795,36 +3757,15 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "windows" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" -dependencies = [ - "windows-implement 0.44.0", - "windows-interface 0.44.0", - "windows-targets 0.42.2", -] - [[package]] name = "windows" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-implement 0.48.0", - "windows-interface 0.48.0", - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-bindgen" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222204ecf46521382a4d88b4a1bbefca9f8855697b4ab7d20803901425e061a3" -dependencies = [ - "windows-metadata 0.44.0", - "windows-tokens 0.44.0", + "windows-implement", + "windows-interface", + "windows-targets", ] [[package]] @@ -3833,19 +3774,8 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fe21a77bc54b7312dbd66f041605e098990c98be48cd52967b85b5e60e75ae6" dependencies = [ - "windows-metadata 0.48.0", - "windows-tokens 0.48.0", -] - -[[package]] -name = "windows-implement" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "windows-metadata", + "windows-tokens", ] [[package]] @@ -3859,17 +3789,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "windows-interface" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "windows-interface" version = "0.48.0" @@ -3881,12 +3800,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "windows-metadata" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee78911e3f4ce32c1ad9d3c7b0bd95389662ad8d8f1a3155688fed70bd96e2b6" - [[package]] name = "windows-metadata" version = "0.48.0" @@ -3914,22 +3827,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -3947,12 +3845,6 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] -[[package]] -name = "windows-tokens" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4251900975a0d10841c5d4bde79c56681543367ef811f3fabb8d1803b0959b" - [[package]] name = "windows-tokens" version = "0.48.0" @@ -4104,9 +3996,9 @@ dependencies = [ "url", "webkit2gtk", "webkit2gtk-sys", - "webview2-com 0.25.0", - "windows 0.48.0", - "windows-implement 0.48.0", + "webview2-com", + "windows", + "windows-implement", ] [[package]] From acff528c3c89508c41723d6bad27ec21e773f1f1 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 15:46:00 -0300 Subject: [PATCH 12/90] use the custom protocol IPC on channel.send --- core/tauri/src/api/ipc.rs | 33 +++++++++++++++++++++++++++++---- core/tauri/src/app.rs | 4 +++- core/tauri/src/hooks.rs | 19 +++++++++++++++---- core/tauri/src/window.rs | 39 ++++++++++++++++++++++++++++----------- 4 files changed, 75 insertions(+), 20 deletions(-) diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index e23e4d537dec..fa6c8f974a91 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -6,6 +6,8 @@ //! //! This module includes utilities to send messages to the JS layer of the webview. +use std::{collections::HashMap, sync::Mutex}; + use serde::{Deserialize, Serialize}; use serde_json::value::RawValue; pub use serialize_to_javascript::Options as SerializeOptions; @@ -15,10 +17,14 @@ use tauri_macros::default_runtime; use crate::{ command::{CommandArg, CommandItem}, hooks::InvokeBody, - InvokeError, Runtime, Window, + InvokeError, Manager, Runtime, Window, }; const CHANNEL_PREFIX: &str = "__CHANNEL__:"; +pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "__tauriFetchChannelData__"; + +#[derive(Default)] +pub(crate) struct ChannelDataCache(pub(crate) Mutex>); /// An IPC channel. #[default_runtime(crate::Wry, wry)] @@ -38,9 +44,28 @@ impl Serialize for Channel { impl Channel { /// Sends the given data through the channel. - pub fn send(&self, data: &S) -> crate::Result<()> { - let js = format_callback(self.id, data)?; - self.window.eval(&js) + pub fn send(&self, data: T) -> crate::Result<()> { + #[cfg(target_os = "linux")] + { + let js = format_callback(self.id, data.body()?.into_json())?; + self.window.eval(&js) + } + #[cfg(not(target_os = "linux"))] + { + let body = data.body()?; + let data_id = rand::random(); + self + .window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + self.window.eval(&format!( + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", + self.id.0 + )) + } } } diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 5d25e051deac..7e93dc49a44a 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -6,7 +6,7 @@ pub(crate) mod tray; use crate::{ - api::ipc::CallbackFn, + api::ipc::{CallbackFn, ChannelDataCache}, command::{CommandArg, CommandItem}, hooks::{InvokeHandler, InvokeResponder, OnPageLoad, PageLoadPayload, SetupHook}, manager::{Asset, CustomProtocol, WindowManager}, @@ -1359,6 +1359,8 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); + app.manage(ChannelDataCache::default()); + #[cfg(windows)] { if let crate::utils::config::WebviewInstallMode::FixedRuntime { path } = &app diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index 650e05a61555..f8480c17fe67 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -7,7 +7,7 @@ use crate::{ app::App, Runtime, StateManager, Window, }; -use serde::{Deserialize, Serialize}; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value as JsonValue; use serialize_to_javascript::{default_template, Template}; use std::{future::Future, sync::Arc}; @@ -59,8 +59,7 @@ impl PageLoadPayload { } /// Possible values of an IPC payload. -#[derive(Debug, Clone, Serialize)] -#[serde(untagged)] +#[derive(Debug, Clone)] pub enum InvokeBody { /// Json payload. Json(JsonValue), @@ -86,8 +85,13 @@ impl From> for InvokeBody { } } +impl IpcResponse for InvokeBody { + fn body(self) -> crate::Result { + Ok(self) + } +} + impl InvokeBody { - #[cfg(any(mobile, test))] pub(crate) fn into_json(self) -> JsonValue { match self { Self::Json(v) => v, @@ -96,6 +100,13 @@ impl InvokeBody { } } } + + pub fn deserialize(self) -> serde_json::Result { + match self { + InvokeBody::Json(v) => serde_json::from_value(v), + InvokeBody::Raw(v) => serde_json::from_slice(&v), + } + } } /// The IPC invoke request. diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 2ad6c1ea27b4..0eb312b5a7ec 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -13,11 +13,11 @@ use url::Url; #[cfg(target_os = "macos")] use crate::TitleBarStyle; use crate::{ - api::ipc::CallbackFn, + api::ipc::{CallbackFn, ChannelDataCache, FETCH_CHANNEL_DATA_COMMAND}, app::AppHandle, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, - hooks::{InvokeBody, InvokeRequest}, + hooks::InvokeRequest, manager::WindowManager, runtime::{ http::{Request as HttpRequest, Response as HttpResponse}, @@ -45,7 +45,7 @@ use crate::{ CursorIcon, Icon, }; -use serde::Serialize; +use serde::{Deserialize, Serialize}; #[cfg(windows)] use windows::Win32::Foundation::HWND; @@ -1724,15 +1724,32 @@ impl Window { ); match request.cmd.as_str() { - "__initialized" => { - let parsed_payload = match request.body { - InvokeBody::Json(v) => serde_json::from_value(v), - InvokeBody::Raw(v) => serde_json::from_slice(&v), - }; - match parsed_payload { + "__initialized" => match request.body.deserialize() { + Ok(payload) => { + manager.run_on_page_load(self, payload); + resolver.resolve(()); + } + Err(e) => resolver.reject(e.to_string()), + }, + FETCH_CHANNEL_DATA_COMMAND => { + #[derive(Deserialize)] + struct FetchChannelDataPayload { + id: u32, + } + + match request.body.deserialize::() { Ok(payload) => { - manager.run_on_page_load(self, payload); - resolver.resolve(()); + if let Some(data) = self + .state::() + .0 + .lock() + .unwrap() + .remove(&payload.id) + { + resolver.resolve(data); + } else { + resolver.reject("Data not found"); + } } Err(e) => resolver.reject(e.to_string()), } From b4c888a7ef9c34c41a027415e603638ab5965169 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 15:55:06 -0300 Subject: [PATCH 13/90] move format_callback to its own module, remove from public API --- core/tauri/src/api/ipc.rs | 304 +--------------------- core/tauri/src/api/ipc/format_callback.rs | 212 +++++++++++++++ core/tauri/src/hooks.rs | 1 + core/tauri/src/window.rs | 4 +- 4 files changed, 219 insertions(+), 302 deletions(-) create mode 100644 core/tauri/src/api/ipc/format_callback.rs diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index fa6c8f974a91..a721ea42f94d 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -9,9 +9,7 @@ use std::{collections::HashMap, sync::Mutex}; use serde::{Deserialize, Serialize}; -use serde_json::value::RawValue; pub use serialize_to_javascript::Options as SerializeOptions; -use serialize_to_javascript::Serialized; use tauri_macros::default_runtime; use crate::{ @@ -20,6 +18,9 @@ use crate::{ InvokeError, Manager, Runtime, Window, }; +#[cfg(target_os = "linux")] +pub(crate) mod format_callback; + const CHANNEL_PREFIX: &str = "__CHANNEL__:"; pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "__tauriFetchChannelData__"; @@ -47,7 +48,7 @@ impl Channel { pub fn send(&self, data: T) -> crate::Result<()> { #[cfg(target_os = "linux")] { - let js = format_callback(self.id, data.body()?.into_json())?; + let js = format_callback::format(self.id, data.body()?.into_json())?; self.window.eval(&js) } #[cfg(not(target_os = "linux"))] @@ -149,300 +150,3 @@ impl Response { /// The `Callback` type is the return value of the `transformCallback` JavaScript function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] pub struct CallbackFn(pub usize); - -/// The information about this is quite limited. On Chrome/Edge and Firefox, [the maximum string size is approximately 1 GB](https://stackoverflow.com/a/34958490). -/// -/// [From MDN:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description) -/// -/// ECMAScript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. Previously, no maximum length was specified. -/// -/// In Firefox, strings have a maximum length of 2\*\*30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2\*\*28 - 1 (~256MB). -const MAX_JSON_STR_LEN: usize = usize::pow(2, 30) - 2; - -/// Minimum size JSON needs to be in order to convert it to JSON.parse with [`format_json`]. -// TODO: this number should be benchmarked and checked for optimal range, I set 10 KiB arbitrarily -// we don't want to lose the gained object parsing time to extra allocations preparing it -const MIN_JSON_PARSE_LEN: usize = 10_240; - -/// Transforms & escapes a JSON value. -/// -/// If it's an object or array, JSON.parse('{json}') is used, with the '{json}' string properly escaped. -/// The return value of this function can be safely used on [`eval`](crate::Window#method.eval) calls. -/// -/// Single quotes chosen because double quotes are already used in JSON. With single quotes, we only -/// need to escape strings that include backslashes or single quotes. If we used double quotes, then -/// there would be no cases that a string doesn't need escaping. -/// -/// The function takes a closure to handle the escaped string in order to avoid unnecessary allocations. -/// -/// # Safety -/// -/// The ability to safely escape JSON into a JSON.parse('{json}') relies entirely on 2 things. -/// -/// 1. `serde_json`'s ability to correctly escape and format json into a string. -/// 2. JavaScript engines not accepting anything except another unescaped, literal single quote -/// character to end a string that was opened with it. -/// -/// # Examples -/// -/// ``` -/// use tauri::api::ipc::{serialize_js_with, SerializeOptions}; -/// #[derive(serde::Serialize)] -/// struct Foo { -/// bar: String, -/// } -/// let foo = Foo { bar: "x".repeat(20_000).into() }; -/// let value = serialize_js_with(&foo, SerializeOptions::default(), |v| format!("console.log({v})")).unwrap(); -/// assert_eq!(value, format!("console.log(JSON.parse('{{\"bar\":\"{}\"}}'))", foo.bar)); -/// ``` -pub fn serialize_js_with String>( - value: &T, - options: SerializeOptions, - cb: F, -) -> crate::api::Result { - // get a raw &str representation of a serialized json value. - let string = serde_json::to_string(value)?; - let raw = RawValue::from_string(string)?; - - // from here we know json.len() > 1 because an empty string is not a valid json value. - let json = raw.get(); - let first = json.as_bytes()[0]; - - #[cfg(debug_assertions)] - if first == b'"' { - assert!( - json.len() < MAX_JSON_STR_LEN, - "passing a string larger than the max JavaScript literal string size" - ) - } - - let return_val = if json.len() > MIN_JSON_PARSE_LEN && (first == b'{' || first == b'[') { - let serialized = Serialized::new(&raw, &options).into_string(); - // only use JSON.parse('{arg}') for arrays and objects less than the limit - // smaller literals do not benefit from being parsed from json - if serialized.len() < MAX_JSON_STR_LEN { - cb(&serialized) - } else { - cb(json) - } - } else { - cb(json) - }; - - Ok(return_val) -} - -/// Transforms & escapes a JSON value. -/// -/// This is a convenience function for [`serialize_js_with`], simply allocating the result to a String. -/// -/// For usage in functions where performance is more important than code readability, see [`serialize_js_with`]. -/// -/// # Examples -/// ```rust,no_run -/// use tauri::{Manager, api::ipc::serialize_js}; -/// use serde::Serialize; -/// -/// #[derive(Serialize)] -/// struct Foo { -/// bar: String, -/// } -/// -/// #[derive(Serialize)] -/// struct Bar { -/// baz: u32, -/// } -/// -/// tauri::Builder::default() -/// .setup(|app| { -/// let window = app.get_window("main").unwrap(); -/// window.eval(&format!( -/// "console.log({}, {})", -/// serialize_js(&Foo { bar: "bar".to_string() }).unwrap(), -/// serialize_js(&Bar { baz: 0 }).unwrap()), -/// )?; -/// Ok(()) -/// }); -/// ``` -pub fn serialize_js(value: &T) -> crate::api::Result { - serialize_js_with(value, Default::default(), |v| v.into()) -} - -/// Formats a function name and argument to be evaluated as callback. -/// -/// This will serialize primitive JSON types (e.g. booleans, strings, numbers, etc.) as JavaScript literals, -/// but will serialize arrays and objects whose serialized JSON string is smaller than 1 GB and larger -/// than 10 KiB with `JSON.parse('...')`. -/// See [json-parse-benchmark](https://github.com/GoogleChromeLabs/json-parse-benchmark). -/// -/// # Examples -/// - With string literals: -/// ``` -/// use tauri::api::ipc::{CallbackFn, format_callback}; -/// // callback with a string argument -/// let cb = format_callback(CallbackFn(12345), &"the string response").unwrap(); -/// assert!(cb.contains(r#"window["_12345"]("the string response")"#)); -/// ``` -/// -/// - With types implement [`serde::Serialize`]: -/// ``` -/// use tauri::api::ipc::{CallbackFn, format_callback}; -/// use serde::Serialize; -/// -/// // callback with large JSON argument -/// #[derive(Serialize)] -/// struct MyResponse { -/// value: String -/// } -/// -/// let cb = format_callback( -/// CallbackFn(6789), -/// &MyResponse { value: String::from_utf8(vec![b'X'; 10_240]).unwrap() -/// }).expect("failed to serialize"); -/// -/// assert!(cb.contains(r#"window["_6789"](JSON.parse('{"value":"XXXXXXXXX"#)); -/// ``` -pub fn format_callback( - function_name: CallbackFn, - arg: &T, -) -> crate::api::Result { - serialize_js_with(arg, Default::default(), |arg| { - format!( - r#" - if (window["_{fn}"]) {{ - window["_{fn}"]({arg}) - }} else {{ - console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.") - }}"#, - fn = function_name.0 - ) - }) -} - -/// Formats a Result type to its Promise response. -/// Useful for Promises handling. -/// If the Result `is_ok()`, the callback will be the `success_callback` function name and the argument will be the Ok value. -/// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. -/// -/// * `result` the Result to check -/// * `success_callback` the function name of the Ok callback. Usually the `resolve` of the JS Promise. -/// * `error_callback` the function name of the Err callback. Usually the `reject` of the JS Promise. -/// -/// Note that the callback strings are automatically generated by the `invoke` helper. -/// -/// # Examples -/// ``` -/// use tauri::api::ipc::{CallbackFn, format_callback_result}; -/// let res: Result = Ok(5); -/// let cb = format_callback_result(res, CallbackFn(145), CallbackFn(0)).expect("failed to format"); -/// assert!(cb.contains(r#"window["_145"](5)"#)); -/// -/// let res: Result<&str, &str> = Err("error message here"); -/// let cb = format_callback_result(res, CallbackFn(2), CallbackFn(1)).expect("failed to format"); -/// assert!(cb.contains(r#"window["_1"]("error message here")"#)); -/// ``` -// TODO: better example to explain -pub fn format_callback_result( - result: Result, - success_callback: CallbackFn, - error_callback: CallbackFn, -) -> crate::api::Result { - match result { - Ok(res) => format_callback(success_callback, &res), - Err(err) => format_callback(error_callback, &err), - } -} - -#[cfg(test)] -mod test { - use crate::api::ipc::*; - use quickcheck::{Arbitrary, Gen}; - use quickcheck_macros::quickcheck; - - impl Arbitrary for CallbackFn { - fn arbitrary(g: &mut Gen) -> CallbackFn { - CallbackFn(usize::arbitrary(g)) - } - } - - #[test] - fn test_serialize_js() { - assert_eq!(serialize_js(&()).unwrap(), "null"); - assert_eq!(serialize_js(&5i32).unwrap(), "5"); - - #[derive(serde::Serialize)] - struct JsonObj { - value: String, - } - - let raw_str = "T".repeat(MIN_JSON_PARSE_LEN); - assert_eq!(serialize_js(&raw_str).unwrap(), format!("\"{raw_str}\"")); - - assert_eq!( - serialize_js(&JsonObj { - value: raw_str.clone() - }) - .unwrap(), - format!("JSON.parse('{{\"value\":\"{raw_str}\"}}')") - ); - - assert_eq!( - serialize_js(&JsonObj { - value: format!("\"{raw_str}\"") - }) - .unwrap(), - format!("JSON.parse('{{\"value\":\"\\\\\"{raw_str}\\\\\"\"}}')") - ); - - let dangerous_json = RawValue::from_string( - r#"{"test":"don\\🚀🐱‍👤\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don't forget to escape me!","test3":"\\🚀🐱‍👤\\\\'''\\\\🚀🐱‍👤\\\\🚀🐱‍👤\\'''''"}"#.into() - ).unwrap(); - - let definitely_escaped_dangerous_json = format!( - "JSON.parse('{}')", - dangerous_json - .get() - .replace('\\', "\\\\") - .replace('\'', "\\'") - ); - let escape_single_quoted_json_test = - serialize_to_javascript::Serialized::new(&dangerous_json, &Default::default()).into_string(); - - let result = r#"JSON.parse('{"test":"don\\\\🚀🐱‍👤\\\\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don\'t forget to escape me!","test3":"\\\\🚀🐱‍👤\\\\\\\\\'\'\'\\\\\\\\🚀🐱‍👤\\\\\\\\🚀🐱‍👤\\\\\'\'\'\'\'"}')"#; - assert_eq!(definitely_escaped_dangerous_json, result); - assert_eq!(escape_single_quoted_json_test, result); - } - - // check arbitrary strings in the format callback function - #[quickcheck] - fn qc_formatting(f: CallbackFn, a: String) -> bool { - // call format callback - let fc = format_callback(f, &a).unwrap(); - fc.contains(&format!( - r#"window["_{}"](JSON.parse('{}'))"#, - f.0, - serde_json::Value::String(a.clone()), - )) || fc.contains(&format!( - r#"window["_{}"]({})"#, - f.0, - serde_json::Value::String(a), - )) - } - - // check arbitrary strings in format_callback_result - #[quickcheck] - fn qc_format_res(result: Result, c: CallbackFn, ec: CallbackFn) -> bool { - let resp = - format_callback_result(result.clone(), c, ec).expect("failed to format callback result"); - let (function, value) = match result { - Ok(v) => (c, v), - Err(e) => (ec, e), - }; - - resp.contains(&format!( - r#"window["_{}"]({})"#, - function.0, - serde_json::Value::String(value), - )) - } -} diff --git a/core/tauri/src/api/ipc/format_callback.rs b/core/tauri/src/api/ipc/format_callback.rs new file mode 100644 index 000000000000..d8d61946dbf9 --- /dev/null +++ b/core/tauri/src/api/ipc/format_callback.rs @@ -0,0 +1,212 @@ +use serde::Serialize; +use serde_json::value::RawValue; +use serialize_to_javascript::Serialized; + +use super::CallbackFn; + +/// The information about this is quite limited. On Chrome/Edge and Firefox, [the maximum string size is approximately 1 GB](https://stackoverflow.com/a/34958490). +/// +/// [From MDN:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description) +/// +/// ECMAScript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. Previously, no maximum length was specified. +/// +/// In Firefox, strings have a maximum length of 2\*\*30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2\*\*28 - 1 (~256MB). +const MAX_JSON_STR_LEN: usize = usize::pow(2, 30) - 2; + +/// Minimum size JSON needs to be in order to convert it to JSON.parse with [`format_json`]. +// TODO: this number should be benchmarked and checked for optimal range, I set 10 KiB arbitrarily +// we don't want to lose the gained object parsing time to extra allocations preparing it +const MIN_JSON_PARSE_LEN: usize = 10_240; + +/// Transforms & escapes a JSON value. +/// +/// If it's an object or array, JSON.parse('{json}') is used, with the '{json}' string properly escaped. +/// The return value of this function can be safely used on [`eval`](crate::Window#method.eval) calls. +/// +/// Single quotes chosen because double quotes are already used in JSON. With single quotes, we only +/// need to escape strings that include backslashes or single quotes. If we used double quotes, then +/// there would be no cases that a string doesn't need escaping. +/// +/// The function takes a closure to handle the escaped string in order to avoid unnecessary allocations. +/// +/// # Safety +/// +/// The ability to safely escape JSON into a JSON.parse('{json}') relies entirely on 2 things. +/// +/// 1. `serde_json`'s ability to correctly escape and format json into a string. +/// 2. JavaScript engines not accepting anything except another unescaped, literal single quote +/// character to end a string that was opened with it. +fn serialize_js_with String>( + value: &T, + options: serialize_to_javascript::Options, + cb: F, +) -> crate::api::Result { + // get a raw &str representation of a serialized json value. + let string = serde_json::to_string(value)?; + let raw = RawValue::from_string(string)?; + + // from here we know json.len() > 1 because an empty string is not a valid json value. + let json = raw.get(); + let first = json.as_bytes()[0]; + + #[cfg(debug_assertions)] + if first == b'"' { + assert!( + json.len() < MAX_JSON_STR_LEN, + "passing a string larger than the max JavaScript literal string size" + ) + } + + let return_val = if json.len() > MIN_JSON_PARSE_LEN && (first == b'{' || first == b'[') { + let serialized = Serialized::new(&raw, &options).into_string(); + // only use JSON.parse('{arg}') for arrays and objects less than the limit + // smaller literals do not benefit from being parsed from json + if serialized.len() < MAX_JSON_STR_LEN { + cb(&serialized) + } else { + cb(json) + } + } else { + cb(json) + }; + + Ok(return_val) +} + +/// Formats a function name and argument to be evaluated as callback. +/// +/// This will serialize primitive JSON types (e.g. booleans, strings, numbers, etc.) as JavaScript literals, +/// but will serialize arrays and objects whose serialized JSON string is smaller than 1 GB and larger +/// than 10 KiB with `JSON.parse('...')`. +/// See [json-parse-benchmark](https://github.com/GoogleChromeLabs/json-parse-benchmark). +pub fn format(function_name: CallbackFn, arg: &T) -> crate::api::Result { + serialize_js_with(arg, Default::default(), |arg| { + format!( + r#" + if (window["_{fn}"]) {{ + window["_{fn}"]({arg}) + }} else {{ + console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.") + }}"#, + fn = function_name.0 + ) + }) +} + +/// Formats a Result type to its Promise response. +/// Useful for Promises handling. +/// If the Result `is_ok()`, the callback will be the `success_callback` function name and the argument will be the Ok value. +/// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. +/// +/// * `result` the Result to check +/// * `success_callback` the function name of the Ok callback. Usually the `resolve` of the JS Promise. +/// * `error_callback` the function name of the Err callback. Usually the `reject` of the JS Promise. +/// +/// Note that the callback strings are automatically generated by the `invoke` helper. +pub fn format_result( + result: Result, + success_callback: CallbackFn, + error_callback: CallbackFn, +) -> crate::api::Result { + match result { + Ok(res) => format(success_callback, &res), + Err(err) => format(error_callback, &err), + } +} + +#[cfg(test)] +mod test { + use super::*; + use quickcheck::{Arbitrary, Gen}; + use quickcheck_macros::quickcheck; + + impl Arbitrary for CallbackFn { + fn arbitrary(g: &mut Gen) -> CallbackFn { + CallbackFn(usize::arbitrary(g)) + } + } + + fn serialize_js(value: &T) -> crate::api::Result { + serialize_js_with(value, Default::default(), |v| v.into()) + } + + #[test] + fn test_serialize_js() { + assert_eq!(serialize_js(&()).unwrap(), "null"); + assert_eq!(serialize_js(&5i32).unwrap(), "5"); + + #[derive(serde::Serialize)] + struct JsonObj { + value: String, + } + + let raw_str = "T".repeat(MIN_JSON_PARSE_LEN); + assert_eq!(serialize_js(&raw_str).unwrap(), format!("\"{raw_str}\"")); + + assert_eq!( + serialize_js(&JsonObj { + value: raw_str.clone() + }) + .unwrap(), + format!("JSON.parse('{{\"value\":\"{raw_str}\"}}')") + ); + + assert_eq!( + serialize_js(&JsonObj { + value: format!("\"{raw_str}\"") + }) + .unwrap(), + format!("JSON.parse('{{\"value\":\"\\\\\"{raw_str}\\\\\"\"}}')") + ); + + let dangerous_json = RawValue::from_string( + r#"{"test":"don\\🚀🐱‍👤\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don't forget to escape me!","test3":"\\🚀🐱‍👤\\\\'''\\\\🚀🐱‍👤\\\\🚀🐱‍👤\\'''''"}"#.into() + ).unwrap(); + + let definitely_escaped_dangerous_json = format!( + "JSON.parse('{}')", + dangerous_json + .get() + .replace('\\', "\\\\") + .replace('\'', "\\'") + ); + let escape_single_quoted_json_test = + serialize_to_javascript::Serialized::new(&dangerous_json, &Default::default()).into_string(); + + let result = r#"JSON.parse('{"test":"don\\\\🚀🐱‍👤\\\\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don\'t forget to escape me!","test3":"\\\\🚀🐱‍👤\\\\\\\\\'\'\'\\\\\\\\🚀🐱‍👤\\\\\\\\🚀🐱‍👤\\\\\'\'\'\'\'"}')"#; + assert_eq!(definitely_escaped_dangerous_json, result); + assert_eq!(escape_single_quoted_json_test, result); + } + + // check arbitrary strings in the format callback function + #[quickcheck] + fn qc_formatting(f: CallbackFn, a: String) -> bool { + // call format callback + let fc = format(f, &a).unwrap(); + fc.contains(&format!( + r#"window["_{}"](JSON.parse('{}'))"#, + f.0, + serde_json::Value::String(a.clone()), + )) || fc.contains(&format!( + r#"window["_{}"]({})"#, + f.0, + serde_json::Value::String(a), + )) + } + + // check arbitrary strings in format_result + #[quickcheck] + fn qc_format_res(result: Result, c: CallbackFn, ec: CallbackFn) -> bool { + let resp = format_result(result.clone(), c, ec).expect("failed to format callback result"); + let (function, value) = match result { + Ok(v) => (c, v), + Err(e) => (ec, e), + }; + + resp.contains(&format!( + r#"window["_{}"]({})"#, + function.0, + serde_json::Value::String(value), + )) + } +} diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index f8480c17fe67..65f148b41f27 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -92,6 +92,7 @@ impl IpcResponse for InvokeBody { } impl InvokeBody { + #[allow(dead_code)] pub(crate) fn into_json(self) -> JsonValue { match self { Self::Json(v) => v, diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 0eb312b5a7ec..935a8d1a333b 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1695,7 +1695,7 @@ impl Window { #[cfg(target_os = "linux")] { if custom_responder.is_none() { - let response_js = match crate::api::ipc::format_callback_result( + let response_js = match crate::api::ipc::format_callback::format_result( match &response { InvokeResponse::Ok(v) => Ok(v), InvokeResponse::Err(e) => Err(&e.0), @@ -1704,7 +1704,7 @@ impl Window { error, ) { Ok(response_js) => response_js, - Err(e) => crate::api::ipc::format_callback(error, &e.to_string()) + Err(e) => crate::api::ipc::format_callback::format(error, &e.to_string()) .expect("unable to serialize response error string to json"), }; From 8c5ac32a8b276421d5cd5fb9b06cef5211277f6a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 18:33:05 -0300 Subject: [PATCH 14/90] add header, fix linux build --- core/tauri/src/api/ipc.rs | 2 +- core/tauri/src/api/ipc/format_callback.rs | 4 ++++ core/tauri/src/window.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs index a721ea42f94d..e99fd5f157f6 100644 --- a/core/tauri/src/api/ipc.rs +++ b/core/tauri/src/api/ipc.rs @@ -48,7 +48,7 @@ impl Channel { pub fn send(&self, data: T) -> crate::Result<()> { #[cfg(target_os = "linux")] { - let js = format_callback::format(self.id, data.body()?.into_json())?; + let js = format_callback::format(self.id, &data.body()?.into_json())?; self.window.eval(&js) } #[cfg(not(target_os = "linux"))] diff --git a/core/tauri/src/api/ipc/format_callback.rs b/core/tauri/src/api/ipc/format_callback.rs index d8d61946dbf9..f149567abf1b 100644 --- a/core/tauri/src/api/ipc/format_callback.rs +++ b/core/tauri/src/api/ipc/format_callback.rs @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + use serde::Serialize; use serde_json::value::RawValue; use serialize_to_javascript::Serialized; diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 935a8d1a333b..d94c511896c4 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1697,7 +1697,7 @@ impl Window { if custom_responder.is_none() { let response_js = match crate::api::ipc::format_callback::format_result( match &response { - InvokeResponse::Ok(v) => Ok(v), + InvokeResponse::Ok(v) => Ok(v.into_json()), InvokeResponse::Err(e) => Err(&e.0), }, callback, From 65e5c0138dd29088d0614c9d1b7a6e6370b38125 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 18:49:57 -0300 Subject: [PATCH 15/90] move hooks.rs to ipc.rs, move api::ipc to root --- core/tauri-macros/src/command/wrapper.rs | 2 +- core/tauri/src/api/ipc.rs | 152 --------------- core/tauri/src/api/mod.rs | 1 - core/tauri/src/app.rs | 29 ++- core/tauri/src/command.rs | 12 +- core/tauri/src/event/commands.rs | 2 +- .../src/{api => }/ipc/format_callback.rs | 0 core/tauri/src/{hooks.rs => ipc/mod.rs} | 176 ++++++++++++++---- core/tauri/src/lib.rs | 6 +- core/tauri/src/manager.rs | 37 ++-- core/tauri/src/plugin.rs | 6 +- core/tauri/src/scope/ipc.rs | 5 +- core/tauri/src/state.rs | 3 +- core/tauri/src/window.rs | 26 ++- examples/commands/main.rs | 5 +- 15 files changed, 226 insertions(+), 236 deletions(-) delete mode 100644 core/tauri/src/api/ipc.rs rename core/tauri/src/{api => }/ipc/format_callback.rs (100%) rename core/tauri/src/{hooks.rs => ipc/mod.rs} (71%) diff --git a/core/tauri-macros/src/command/wrapper.rs b/core/tauri-macros/src/command/wrapper.rs index 19dbb2c379d8..fab592417eb4 100644 --- a/core/tauri-macros/src/command/wrapper.rs +++ b/core/tauri-macros/src/command/wrapper.rs @@ -211,7 +211,7 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream { use #root::command::private::*; // prevent warnings when the body is a `compile_error!` or if the command has no arguments #[allow(unused_variables)] - let #root::Invoke { message: #message, resolver: #resolver } = $invoke; + let #root::ipc::Invoke { message: #message, resolver: #resolver } = $invoke; #body }}; diff --git a/core/tauri/src/api/ipc.rs b/core/tauri/src/api/ipc.rs deleted file mode 100644 index e99fd5f157f6..000000000000 --- a/core/tauri/src/api/ipc.rs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -//! Types and functions related to Inter Procedure Call(IPC). -//! -//! This module includes utilities to send messages to the JS layer of the webview. - -use std::{collections::HashMap, sync::Mutex}; - -use serde::{Deserialize, Serialize}; -pub use serialize_to_javascript::Options as SerializeOptions; -use tauri_macros::default_runtime; - -use crate::{ - command::{CommandArg, CommandItem}, - hooks::InvokeBody, - InvokeError, Manager, Runtime, Window, -}; - -#[cfg(target_os = "linux")] -pub(crate) mod format_callback; - -const CHANNEL_PREFIX: &str = "__CHANNEL__:"; -pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "__tauriFetchChannelData__"; - -#[derive(Default)] -pub(crate) struct ChannelDataCache(pub(crate) Mutex>); - -/// An IPC channel. -#[default_runtime(crate::Wry, wry)] -pub struct Channel { - id: CallbackFn, - window: Window, -} - -impl Serialize for Channel { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&format!("{CHANNEL_PREFIX}{}", self.id.0)) - } -} - -impl Channel { - /// Sends the given data through the channel. - pub fn send(&self, data: T) -> crate::Result<()> { - #[cfg(target_os = "linux")] - { - let js = format_callback::format(self.id, &data.body()?.into_json())?; - self.window.eval(&js) - } - #[cfg(not(target_os = "linux"))] - { - let body = data.body()?; - let data_id = rand::random(); - self - .window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - self.window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", - self.id.0 - )) - } - } -} - -impl<'de, R: Runtime> CommandArg<'de, R> for Channel { - /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`Channel`]. - fn from_command(command: CommandItem<'de, R>) -> Result { - let name = command.name; - let arg = command.key; - let window = command.message.window(); - let value: String = - Deserialize::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e))?; - if let Some(callback_id) = value - .split_once(CHANNEL_PREFIX) - .and_then(|(_prefix, id)| id.parse().ok()) - { - return Ok(Channel { - id: CallbackFn(callback_id), - window, - }); - } - Err(InvokeError::from_anyhow(anyhow::anyhow!( - "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" - ))) - } -} - -/// The IPC request. -#[derive(Debug)] -pub struct Request<'a> { - body: &'a InvokeBody, -} - -impl<'a> Request<'a> { - /// The request body. - pub fn body(&self) -> &InvokeBody { - self.body - } -} - -impl<'a, R: Runtime> CommandArg<'a, R> for Request<'a> { - /// Returns the invoke [`Request`]. - fn from_command(command: CommandItem<'a, R>) -> Result { - Ok(Self { - body: &command.message.payload, - }) - } -} - -/// Marks a type as a response to an IPC call. -pub trait IpcResponse { - /// Resolve the IPC response body. - fn body(self) -> crate::Result; -} - -impl IpcResponse for T { - fn body(self) -> crate::Result { - serde_json::to_value(self) - .map(Into::into) - .map_err(Into::into) - } -} - -/// The IPC request. -pub struct Response { - body: InvokeBody, -} - -impl IpcResponse for Response { - fn body(self) -> crate::Result { - Ok(self.body) - } -} - -impl Response { - /// Defines a response with the given body. - pub fn new(body: impl Into) -> Self { - Self { body: body.into() } - } -} - -/// The `Callback` type is the return value of the `transformCallback` JavaScript function. -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] -pub struct CallbackFn(pub usize); diff --git a/core/tauri/src/api/mod.rs b/core/tauri/src/api/mod.rs index f3d24f4c39b4..1bfd02f16a5f 100644 --- a/core/tauri/src/api/mod.rs +++ b/core/tauri/src/api/mod.rs @@ -6,7 +6,6 @@ pub mod dir; pub mod file; -pub mod ipc; pub mod version; mod error; diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 7e93dc49a44a..ffaedd4aff7e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -6,9 +6,11 @@ pub(crate) mod tray; use crate::{ - api::ipc::{CallbackFn, ChannelDataCache}, command::{CommandArg, CommandItem}, - hooks::{InvokeHandler, InvokeResponder, OnPageLoad, PageLoadPayload, SetupHook}, + ipc::{ + CallbackFn, ChannelDataCache, Invoke, InvokeError, InvokeHandler, InvokeResponder, + InvokeResponse, + }, manager::{Asset, CustomProtocol, WindowManager}, plugin::{Plugin, PluginStore}, runtime::{ @@ -21,14 +23,15 @@ use crate::{ sealed::{ManagerBase, RuntimeOrDispatch}, utils::config::Config, utils::{assets::Assets, Env}, - Context, DeviceEventFilter, EventLoopMessage, Icon, Invoke, InvokeError, InvokeResponse, Manager, - Runtime, Scopes, StateManager, Theme, Window, + Context, DeviceEventFilter, EventLoopMessage, Icon, Manager, Runtime, Scopes, StateManager, + Theme, Window, }; #[cfg(feature = "protocol-asset")] use crate::scope::FsScope; use raw_window_handle::HasRawDisplayHandle; +use serde::Deserialize; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use tauri_macros::default_runtime; use tauri_runtime::window::{ @@ -54,6 +57,24 @@ pub(crate) type GlobalMenuEventListener = Box) + Se pub(crate) type GlobalWindowEventListener = Box) + Send + Sync>; #[cfg(all(desktop, feature = "system-tray"))] type SystemTrayEventListener = Box, tray::SystemTrayEvent) + Send + Sync>; +/// A closure that is run when the Tauri application is setting up. +pub type SetupHook = + Box) -> Result<(), Box> + Send>; +/// A closure that is run once every time a window is created and loaded. +pub type OnPageLoad = dyn Fn(Window, PageLoadPayload) + Send + Sync + 'static; + +/// The payload for the [`OnPageLoad`] hook. +#[derive(Debug, Clone, Deserialize)] +pub struct PageLoadPayload { + url: String, +} + +impl PageLoadPayload { + /// The page URL. + pub fn url(&self) -> &str { + &self.url + } +} /// Api exposed on the `ExitRequested` event. #[derive(Debug)] diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index 1128e33b0ee9..f3da5359dcf5 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -7,9 +7,10 @@ //! You usually don't need to create these items yourself. These are created from [command](../attr.command.html) //! attribute macro along the way and used by [`crate::generate_handler`] macro. -use crate::hooks::{InvokeBody, InvokeError}; -use crate::InvokeMessage; -use crate::Runtime; +use crate::{ + ipc::{InvokeBody, InvokeError, InvokeMessage}, + Runtime, +}; use serde::{ de::{Error, Visitor}, Deserialize, Deserializer, @@ -171,7 +172,10 @@ impl<'de, R: Runtime> Deserializer<'de> for CommandItem<'de, R> { /// Nothing in this module is considered stable. #[doc(hidden)] pub mod private { - use crate::{api::ipc::IpcResponse, hooks::InvokeBody, InvokeError, InvokeResolver, Runtime}; + use crate::{ + ipc::{InvokeBody, InvokeError, InvokeResolver, IpcResponse}, + Runtime, + }; use futures_util::{FutureExt, TryFutureExt}; use std::future::Future; diff --git a/core/tauri/src/event/commands.rs b/core/tauri/src/event/commands.rs index 4a5cbeb5db39..a6b2b7dd0d17 100644 --- a/core/tauri/src/event/commands.rs +++ b/core/tauri/src/event/commands.rs @@ -1,4 +1,4 @@ -use crate::{api::ipc::CallbackFn, command, Manager, Result, Runtime, Window}; +use crate::{ipc::CallbackFn, command, Manager, Result, Runtime, Window}; use serde::{Deserialize, Deserializer}; use serde_json::Value as JsonValue; use tauri_runtime::window::is_label_valid; diff --git a/core/tauri/src/api/ipc/format_callback.rs b/core/tauri/src/ipc/format_callback.rs similarity index 100% rename from core/tauri/src/api/ipc/format_callback.rs rename to core/tauri/src/ipc/format_callback.rs diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/ipc/mod.rs similarity index 71% rename from core/tauri/src/hooks.rs rename to core/tauri/src/ipc/mod.rs index 65f148b41f27..b54fc0f0ee3c 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/ipc/mod.rs @@ -2,21 +2,28 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::{ - api::ipc::{CallbackFn, IpcResponse}, - app::App, - Runtime, StateManager, Window, +//! Types and functions related to Inter Procedure Call(IPC). +//! +//! This module includes utilities to send messages to the JS layer of the webview. + +use std::{ + collections::HashMap, + sync::{Arc, Mutex}, }; + +use futures_util::Future; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value as JsonValue; -use serialize_to_javascript::{default_template, Template}; -use std::{future::Future, sync::Arc}; - +pub use serialize_to_javascript::Options as SerializeOptions; use tauri_macros::default_runtime; -/// A closure that is run when the Tauri application is setting up. -pub type SetupHook = - Box) -> Result<(), Box> + Send>; +use crate::{ + command::{CommandArg, CommandItem}, + Manager, Runtime, StateManager, Window, +}; + +#[cfg(target_os = "linux")] +pub(crate) mod format_callback; /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; @@ -27,34 +34,75 @@ pub type InvokeResponder = type OwnedInvokeResponder = dyn Fn(Window, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; -/// A closure that is run once every time a window is created and loaded. -pub type OnPageLoad = dyn Fn(Window, PageLoadPayload) + Send + Sync + 'static; +const CHANNEL_PREFIX: &str = "__CHANNEL__:"; +pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "__tauriFetchChannelData__"; + +#[derive(Default)] +pub(crate) struct ChannelDataCache(pub(crate) Mutex>); -// todo: why is this derive broken but the output works manually? -#[derive(Template)] -#[default_template("../scripts/ipc.js")] -pub(crate) struct IpcJavascript<'a> { - pub(crate) isolation_origin: &'a str, +/// An IPC channel. +#[default_runtime(crate::Wry, wry)] +pub struct Channel { + id: CallbackFn, + window: Window, } -#[cfg(feature = "isolation")] -#[derive(Template)] -#[default_template("../scripts/isolation.js")] -pub(crate) struct IsolationJavascript<'a> { - pub(crate) isolation_src: &'a str, - pub(crate) style: &'a str, +impl Serialize for Channel { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(&format!("{CHANNEL_PREFIX}{}", self.id.0)) + } } -/// The payload for the [`OnPageLoad`] hook. -#[derive(Debug, Clone, Deserialize)] -pub struct PageLoadPayload { - url: String, +impl Channel { + /// Sends the given data through the channel. + pub fn send(&self, data: T) -> crate::Result<()> { + #[cfg(target_os = "linux")] + { + let js = format_callback::format(self.id, &data.body()?.into_json())?; + self.window.eval(&js) + } + #[cfg(not(target_os = "linux"))] + { + let body = data.body()?; + let data_id = rand::random(); + self + .window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + self.window.eval(&format!( + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", + self.id.0 + )) + } + } } -impl PageLoadPayload { - /// The page URL. - pub fn url(&self) -> &str { - &self.url +impl<'de, R: Runtime> CommandArg<'de, R> for Channel { + /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`Channel`]. + fn from_command(command: CommandItem<'de, R>) -> Result { + let name = command.name; + let arg = command.key; + let window = command.message.window(); + let value: String = + Deserialize::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e))?; + if let Some(callback_id) = value + .split_once(CHANNEL_PREFIX) + .and_then(|(_prefix, id)| id.parse().ok()) + { + return Ok(Channel { + id: CallbackFn(callback_id), + window, + }); + } + Err(InvokeError::from_anyhow(anyhow::anyhow!( + "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" + ))) } } @@ -102,6 +150,7 @@ impl InvokeBody { } } + /// Attempts to deserialize the invoke body. pub fn deserialize(self) -> serde_json::Result { match self { InvokeBody::Json(v) => serde_json::from_value(v), @@ -110,17 +159,58 @@ impl InvokeBody { } } -/// The IPC invoke request. +/// The IPC request. #[derive(Debug)] -pub struct InvokeRequest { - /// The invoke command. - pub cmd: String, - /// The success callback. - pub callback: CallbackFn, - /// The error callback. - pub error: CallbackFn, - /// The body of the request. - pub body: InvokeBody, +pub struct Request<'a> { + body: &'a InvokeBody, +} + +impl<'a> Request<'a> { + /// The request body. + pub fn body(&self) -> &InvokeBody { + self.body + } +} + +impl<'a, R: Runtime> CommandArg<'a, R> for Request<'a> { + /// Returns the invoke [`Request`]. + fn from_command(command: CommandItem<'a, R>) -> Result { + Ok(Self { + body: &command.message.payload, + }) + } +} + +/// Marks a type as a response to an IPC call. +pub trait IpcResponse { + /// Resolve the IPC response body. + fn body(self) -> crate::Result; +} + +impl IpcResponse for T { + fn body(self) -> crate::Result { + serde_json::to_value(self) + .map(Into::into) + .map_err(Into::into) + } +} + +/// The IPC request. +pub struct Response { + body: InvokeBody, +} + +impl IpcResponse for Response { + fn body(self) -> crate::Result { + Ok(self.body) + } +} + +impl Response { + /// Defines a response with the given body. + pub fn new(body: impl Into) -> Self { + Self { body: body.into() } + } } /// The message and resolver given to a custom command. @@ -428,3 +518,7 @@ impl InvokeMessage { &self.state } } + +/// The `Callback` type is the return value of the `transformCallback` JavaScript function. +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] +pub struct CallbackFn(pub usize); diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 16d93bf9cdb0..7f37d17dc58d 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -74,7 +74,7 @@ pub mod async_runtime; pub mod command; mod error; mod event; -mod hooks; +pub mod ipc; mod manager; mod pattern; pub mod plugin; @@ -173,10 +173,6 @@ pub use { App, AppHandle, AssetResolver, Builder, CloseRequestApi, GlobalWindowEvent, RunEvent, WindowEvent, }, - self::hooks::{ - Invoke, InvokeError, InvokeHandler, InvokeMessage, InvokeRequest, InvokeResolver, - InvokeResponder, InvokeResponse, OnPageLoad, PageLoadPayload, SetupHook, - }, self::manager::Asset, self::runtime::{ webview::WebviewAttributes, diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 9adc9c97ce77..cb9463b87ec1 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -28,17 +28,14 @@ use tauri_utils::{ html::{SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN}, }; -#[cfg(feature = "isolation")] -use crate::hooks::IsolationJavascript; -use crate::{ - api::ipc::CallbackFn, - hooks::IpcJavascript, - window::{UriSchemeProtocolHandler, WebResourceRequestHandler}, -}; use crate::{ - app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, + app::{ + AppHandle, GlobalMenuEventListener, GlobalWindowEvent, GlobalWindowEventListener, OnPageLoad, + PageLoadPayload, WindowMenuEvent, + }, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, - hooks::{InvokeHandler, InvokeRequest, InvokeResponder, OnPageLoad, PageLoadPayload}, + ipc::{CallbackFn, Invoke, InvokeBody, InvokeHandler, InvokeResponder, InvokeResponse}, + pattern::PatternJavascript, plugin::PluginStore, runtime::{ http::{ @@ -53,14 +50,10 @@ use crate::{ config::{AppUrl, Config, WindowUrl}, PackageInfo, }, - Context, EventLoopMessage, Icon, Invoke, Manager, Pattern, Runtime, Scopes, StateManager, Window, + window::{InvokeRequest, UriSchemeProtocolHandler, WebResourceRequestHandler}, + Context, EventLoopMessage, Icon, Manager, Pattern, Runtime, Scopes, StateManager, Window, WindowEvent, }; -use crate::{ - app::{GlobalMenuEventListener, WindowMenuEvent}, - hooks::InvokeBody, -}; -use crate::{pattern::PatternJavascript, InvokeResponse}; #[cfg(any(target_os = "linux", target_os = "windows"))] use crate::path::BaseDirectory; @@ -89,6 +82,20 @@ pub(crate) const PROCESS_IPC_MESSAGE_FN: &str = // must also keep in sync with the `let mut response` assignment in prepare_uri_scheme_protocol const PROXY_DEV_SERVER: bool = cfg!(all(dev, mobile)); +#[cfg(feature = "isolation")] +#[derive(Template)] +#[default_template("../scripts/isolation.js")] +pub(crate) struct IsolationJavascript<'a> { + pub(crate) isolation_src: &'a str, + pub(crate) style: &'a str, +} + +#[derive(Template)] +#[default_template("../scripts/ipc.js")] +pub(crate) struct IpcJavascript<'a> { + pub(crate) isolation_origin: &'a str, +} + #[derive(Default)] /// Spaced and quoted Content-Security-Policy hash values. struct CspHashStrings { diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index c7a67913cec4..226d488f7a5f 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -5,8 +5,10 @@ //! The Tauri plugin extension to expand Tauri functionality. use crate::{ - utils::config::PluginConfig, AppHandle, Invoke, InvokeHandler, PageLoadPayload, RunEvent, - Runtime, Window, + app::PageLoadPayload, + ipc::{Invoke, InvokeHandler}, + utils::config::PluginConfig, + AppHandle, RunEvent, Runtime, Window, }; use serde::de::DeserializeOwned; use serde_json::Value as JsonValue; diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index 138531f06b8e..cf432dec4389 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -170,7 +170,10 @@ mod tests { use super::RemoteDomainAccessScope; use crate::{ - api::ipc::CallbackFn, test::MockRuntime, App, InvokeRequest, InvokeResponse, Manager, Window, + ipc::{CallbackFn, InvokeResponse}, + test::MockRuntime, + window::InvokeRequest, + App, Manager, Window, }; const PLUGIN_NAME: &str = "test"; diff --git a/core/tauri/src/state.rs b/core/tauri/src/state.rs index b13f0c0f3f4a..ae64067f5faf 100644 --- a/core/tauri/src/state.rs +++ b/core/tauri/src/state.rs @@ -4,7 +4,8 @@ use crate::{ command::{CommandArg, CommandItem}, - InvokeError, Runtime, + ipc::InvokeError, + Runtime, }; use state::Container; diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index d94c511896c4..54e427c66e15 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -13,11 +13,13 @@ use url::Url; #[cfg(target_os = "macos")] use crate::TitleBarStyle; use crate::{ - api::ipc::{CallbackFn, ChannelDataCache, FETCH_CHANNEL_DATA_COMMAND}, app::AppHandle, command::{CommandArg, CommandItem}, event::{Event, EventHandler}, - hooks::InvokeRequest, + ipc::{ + CallbackFn, ChannelDataCache, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, + InvokeResponse, FETCH_CHANNEL_DATA_COMMAND, + }, manager::WindowManager, runtime::{ http::{Request as HttpRequest, Response as HttpResponse}, @@ -32,8 +34,7 @@ use crate::{ sealed::ManagerBase, sealed::RuntimeOrDispatch, utils::config::{WindowConfig, WindowEffectsConfig, WindowUrl}, - EventLoopMessage, Invoke, InvokeError, InvokeMessage, InvokeResolver, InvokeResponse, Manager, - Runtime, Theme, WindowEvent, + EventLoopMessage, Manager, Runtime, Theme, WindowEvent, }; #[cfg(desktop)] use crate::{ @@ -768,6 +769,19 @@ struct JsEventListenerKey { pub event: String, } +/// The IPC invoke request. +#[derive(Debug)] +pub struct InvokeRequest { + /// The invoke command. + pub cmd: String, + /// The success callback. + pub callback: CallbackFn, + /// The error callback. + pub error: CallbackFn, + /// The body of the request. + pub body: InvokeBody, +} + // TODO: expand these docs since this is a pretty important type /// A webview window managed by Tauri. /// @@ -1695,7 +1709,7 @@ impl Window { #[cfg(target_os = "linux")] { if custom_responder.is_none() { - let response_js = match crate::api::ipc::format_callback::format_result( + let response_js = match crate::ipc::format_callback::format_result( match &response { InvokeResponse::Ok(v) => Ok(v.into_json()), InvokeResponse::Err(e) => Err(&e.0), @@ -1704,7 +1718,7 @@ impl Window { error, ) { Ok(response_js) => response_js, - Err(e) => crate::api::ipc::format_callback::format(error, &e.to_string()) + Err(e) => crate::ipc::format_callback::format(error, &e.to_string()) .expect("unable to serialize response error string to json"), }; diff --git a/examples/commands/main.rs b/examples/commands/main.rs index ca2fe76877ed..f9c1504b9dd5 100644 --- a/examples/commands/main.rs +++ b/examples/commands/main.rs @@ -10,8 +10,9 @@ use commands::{cmd, invoke, message, resolver}; use serde::Deserialize; use tauri::{ - api::ipc::{Request, Response}, - command, State, Window, + command, + ipc::{Request, Response}, + State, Window, }; #[derive(Debug)] From 073f63a9f4fac06d7212a09f6a8b3e9b653ab2af Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 18:51:11 -0300 Subject: [PATCH 16/90] fix mobile build --- core/tauri/src/plugin/mobile.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 0f482b353112..ad5b71a33586 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -4,7 +4,7 @@ use super::{PluginApi, PluginHandle}; -use crate::{hooks::InvokeBody, AppHandle, Runtime}; +use crate::{ipc::InvokeBody, AppHandle, Runtime}; #[cfg(target_os = "android")] use crate::{ runtime::RuntimeHandle, From a329082de46de77e61e755519ba2a35c8ce4f292 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 18:54:22 -0300 Subject: [PATCH 17/90] headers --- core/tauri/src/event/commands.rs | 6 +++++- core/tauri/src/event/listener.rs | 4 ++++ tooling/cli/node/index.d.ts | 4 ++++ tooling/cli/node/index.js | 4 ++++ tooling/cli/src/info/ios.rs | 4 ++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/tauri/src/event/commands.rs b/core/tauri/src/event/commands.rs index a6b2b7dd0d17..d710a84a0279 100644 --- a/core/tauri/src/event/commands.rs +++ b/core/tauri/src/event/commands.rs @@ -1,4 +1,8 @@ -use crate::{ipc::CallbackFn, command, Manager, Result, Runtime, Window}; +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use crate::{command, ipc::CallbackFn, Manager, Result, Runtime, Window}; use serde::{Deserialize, Deserializer}; use serde_json::Value as JsonValue; use tauri_runtime::window::is_label_valid; diff --git a/core/tauri/src/event/listener.rs b/core/tauri/src/event/listener.rs index dc4475e67b33..db1263cf3da8 100644 --- a/core/tauri/src/event/listener.rs +++ b/core/tauri/src/event/listener.rs @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + use super::{Event, EventHandler}; use std::{ diff --git a/tooling/cli/node/index.d.ts b/tooling/cli/node/index.d.ts index b562ef74ab8c..c4a7e39b9334 100644 --- a/tooling/cli/node/index.d.ts +++ b/tooling/cli/node/index.d.ts @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + /* tslint:disable */ /* eslint-disable */ diff --git a/tooling/cli/node/index.js b/tooling/cli/node/index.js index df687e1ced13..f280ce3b3db5 100644 --- a/tooling/cli/node/index.js +++ b/tooling/cli/node/index.js @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ diff --git a/tooling/cli/src/info/ios.rs b/tooling/cli/src/info/ios.rs index d352fbe36a4e..1c193d487677 100644 --- a/tooling/cli/src/info/ios.rs +++ b/tooling/cli/src/info/ios.rs @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + use super::{SectionItem, Status}; use colored::Colorize; From 596968d1d744b02d7b33c953656db351762094c0 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 20:03:01 -0300 Subject: [PATCH 18/90] avoid into_json call so we dont need to clone --- core/tauri/src/ipc/mod.rs | 4 +++- core/tauri/src/window.rs | 26 +++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index a73a72af9fce..8ed542e6cfa9 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -19,7 +19,7 @@ use tauri_macros::default_runtime; use crate::{ command::{CommandArg, CommandItem}, - Manager, Runtime, StateManager, Window, + Runtime, StateManager, Window, }; #[cfg(target_os = "linux")] @@ -75,6 +75,8 @@ impl Channel { } #[cfg(not(target_os = "linux"))] { + use crate::Manager; + let body = data.body()?; let data_id = rand::random(); self diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 54e427c66e15..879fb3d78644 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1708,17 +1708,25 @@ impl Window { move |window, response, callback, error| { #[cfg(target_os = "linux")] { + use crate::ipc::format_callback::{ + format as format_callback, format_result as format_callback_result, + }; if custom_responder.is_none() { - let response_js = match crate::ipc::format_callback::format_result( - match &response { - InvokeResponse::Ok(v) => Ok(v.into_json()), - InvokeResponse::Err(e) => Err(&e.0), - }, - callback, - error, - ) { + let formatted_js = match &response { + InvokeResponse::Ok(InvokeBody::Json(v)) => { + format_callback_result(Result::<_, ()>::Ok(v), callback, error) + } + InvokeResponse::Ok(InvokeBody::Raw(v)) => { + format_callback_result(Result::<_, ()>::Ok(v), callback, error) + } + InvokeResponse::Err(e) => { + format_callback_result(Result::<(), _>::Err(&e.0), callback, error) + } + }; + + let response_js = match formatted_js { Ok(response_js) => response_js, - Err(e) => crate::ipc::format_callback::format(error, &e.to_string()) + Err(e) => format_callback(error, &e.to_string()) .expect("unable to serialize response error string to json"), }; From c5b841baf7d97414443fe1ee7b15d5e2550bb240 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 11 Jun 2023 20:53:17 -0300 Subject: [PATCH 19/90] remove linux-protocol-headers feature from ci --- .github/workflows/lint-core.yml | 2 +- .github/workflows/test-core.yml | 2 +- core/tauri/src/lib.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-core.yml b/.github/workflows/lint-core.yml index 68b01ea6b6d7..bd61f4ee0c1a 100644 --- a/.github/workflows/lint-core.yml +++ b/.github/workflows/lint-core.yml @@ -50,7 +50,7 @@ jobs: clippy: - { args: '', key: 'empty' } - { - args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray', + args: '--features compression,wry,isolation,custom-protocol,system-tray', key: 'all' } - { args: '--features custom-protocol', key: 'custom-protocol' } diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 39d5c16d0bd7..fcf7395df1cb 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -72,7 +72,7 @@ jobs: key: no-default } - { - args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray, + args: --features compression,wry,isolation,custom-protocol,system-tray, key: all } diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 7f37d17dc58d..044f9aa5152f 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -13,7 +13,6 @@ //! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime. //! - **dox**: Internal feature to generate Rust documentation without linking on Linux. //! - **objc-exception**: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust. -//! - **linux-protocol-headers**: Enables headers support for custom protocol requests on Linux. Requires webkit2gtk v2.36 or above. //! - **isolation**: Enables the isolation pattern. Enabled by default if the `tauri > pattern > use` config option is set to `isolation` on the `tauri.conf.json` file. //! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one. //! - **devtools**: Enables the developer tools (Web inspector) and [`Window::open_devtools`]. Enabled by default on debug builds. From da2d00b2c881163b6a2091ed7889783b6bb0ceaa Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 10:25:38 -0300 Subject: [PATCH 20/90] use custom protocol on linux!!!!!!!! --- core/tauri-runtime-wry/Cargo.toml | 4 +- core/tauri-runtime-wry/src/lib.rs | 39 +---- core/tauri-runtime/src/webview.rs | 5 +- core/tauri-runtime/src/window.rs | 7 +- core/tauri/Cargo.toml | 2 +- core/tauri/scripts/ipc-post-message.js | 13 -- core/tauri/src/app.rs | 16 -- core/tauri/src/ipc/format_callback.rs | 216 ------------------------- core/tauri/src/ipc/mod.rs | 35 ++-- core/tauri/src/manager.rs | 75 --------- core/tauri/src/window.rs | 28 ---- examples/api/src-tauri/Cargo.lock | 18 +-- 12 files changed, 28 insertions(+), 430 deletions(-) delete mode 100644 core/tauri/scripts/ipc-post-message.js delete mode 100644 core/tauri/src/ipc/format_callback.rs diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 25ee92bfe069..791be1887b7c 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { git = "https://github.com/tauri-apps/wry", branch = "feat/android-protocol-req-body", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } +wry = { git = "https://github.com/tauri-apps/wry", branch = "linux-body", default-features = false, features = [ "file-drop", "protocol", "linux-body" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } @@ -31,7 +31,7 @@ webview2-com = "0.25" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } -webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } +webkit2gtk = { version = "1.1", features = [ "v2_40" ] } percent-encoding = "2.1" [target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 629e72c91c6b..8ced2b3f9edf 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -7,9 +7,9 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle}; use tauri_runtime::{ http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse}, - menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate}, + menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuItem, MenuUpdate}, monitor::Monitor, - webview::{WebviewIpcHandler, WindowBuilder, WindowBuilderBase}, + webview::{WindowBuilder, WindowBuilderBase}, window::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, PendingWindow, WindowEvent, @@ -105,7 +105,6 @@ use std::{ }; pub type WebviewId = u64; -type IpcHandler = dyn Fn(&Window, String) + 'static; type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static; #[cfg(all(desktop, feature = "system-tray"))] pub use tauri_runtime::TrayId; @@ -3002,9 +3001,7 @@ fn create_webview( uri_scheme_protocols, mut window_builder, label, - ipc_handler, url, - menu_ids, #[cfg(target_os = "android")] on_webview_created, .. @@ -3084,15 +3081,6 @@ fn create_webview( } } - if let Some(handler) = ipc_handler { - webview_builder = webview_builder.with_ipc_handler(create_ipc_handler( - context, - label.clone(), - menu_ids, - handler, - )); - } - for (scheme, protocol) in uri_scheme_protocols { webview_builder = webview_builder.with_custom_protocol(scheme, move |wry_request| { protocol(&HttpRequestWrapper::from(wry_request).0) @@ -3211,29 +3199,6 @@ fn create_webview( }) } -/// Create a wry ipc handler from a tauri ipc handler. -fn create_ipc_handler( - context: Context, - label: String, - menu_ids: Arc>>, - handler: WebviewIpcHandler>, -) -> Box { - Box::new(move |window, request| { - let window_id = context.webview_id_map.get(&window.id()).unwrap(); - handler( - DetachedWindow { - dispatcher: WryDispatcher { - window_id, - context: context.clone(), - }, - label: label.clone(), - menu_ids: menu_ids.clone(), - }, - request, - ); - }) -} - /// Create a wry file drop handler. fn create_file_drop_handler(window_event_listeners: WindowEventListeners) -> Box { Box::new(move |_window, event| { diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 888c127f5806..e9dd69b66c5a 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,7 +4,7 @@ //! Items specific to the [`Runtime`](crate::Runtime)'s webview. -use crate::{menu::Menu, window::DetachedWindow, Icon}; +use crate::{menu::Menu, Icon}; #[cfg(target_os = "macos")] use tauri_utils::TitleBarStyle; @@ -331,6 +331,3 @@ pub trait WindowBuilder: WindowBuilderBase { /// Gets the window menu. fn get_menu(&self) -> Option<&Menu>; } - -/// IPC handler. -pub type WebviewIpcHandler = Box, String) + Send>; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index fbb7899f9b92..c9522e1f0fd8 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -7,7 +7,7 @@ use crate::{ http::{Request as HttpRequest, Response as HttpResponse}, menu::{Menu, MenuEntry, MenuHash, MenuId}, - webview::{WebviewAttributes, WebviewIpcHandler}, + webview::WebviewAttributes, Dispatch, Runtime, UserEvent, WindowBuilder, }; use serde::{Deserialize, Deserializer, Serialize}; @@ -226,9 +226,6 @@ pub struct PendingWindow> { pub uri_scheme_protocols: HashMap>, - /// How to handle IPC calls on the webview window. - pub ipc_handler: Option>, - /// Maps runtime id to a string menu id. pub menu_ids: Arc>>, @@ -279,7 +276,6 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, - ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), @@ -311,7 +307,6 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, - ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 839dc1e6cd57..bbcb34ae5e6a 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -73,7 +73,7 @@ ico = { version = "0.2.0", optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } glib = "0.16" -webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } +webkit2gtk = { version = "1.1", features = [ "v2_40" ] } [target."cfg(target_os = \"macos\")".dependencies] embed_plist = "1.2" diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js deleted file mode 100644 index 9b8d5de1c7e7..000000000000 --- a/core/tauri/scripts/ipc-post-message.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -(function () { - Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { - value: (message) => { - const { cmd, callback, error, payload } = message - const { data } = __RAW_process_ipc_message_fn__({ cmd, callback, error, ...payload }) - window.ipc.postMessage(data) - } - }) -})() diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index ffaedd4aff7e..b22b85dfca9f 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -840,14 +840,6 @@ struct ProtocolInvokeInitializationScript<'a> { process_ipc_message_fn: &'a str, } -#[derive(Template)] -#[default_template("../scripts/ipc-post-message.js")] -struct PostMessageInvokeInitializationScript<'a> { - /// The function that processes the IPC message. - #[raw] - process_ipc_message_fn: &'a str, -} - impl Builder { /// Creates a new App builder. pub fn new() -> Self { @@ -857,14 +849,6 @@ impl Builder { setup: Box::new(|_| Ok(())), invoke_handler: Box::new(|_| false), invoke_responder: None, - #[cfg(target_os = "linux")] - invoke_initialization_script: PostMessageInvokeInitializationScript { - process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, - } - .render_default(&Default::default()) - .unwrap() - .into_string(), - #[cfg(not(target_os = "linux"))] invoke_initialization_script: ProtocolInvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, } diff --git a/core/tauri/src/ipc/format_callback.rs b/core/tauri/src/ipc/format_callback.rs deleted file mode 100644 index f149567abf1b..000000000000 --- a/core/tauri/src/ipc/format_callback.rs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -use serde::Serialize; -use serde_json::value::RawValue; -use serialize_to_javascript::Serialized; - -use super::CallbackFn; - -/// The information about this is quite limited. On Chrome/Edge and Firefox, [the maximum string size is approximately 1 GB](https://stackoverflow.com/a/34958490). -/// -/// [From MDN:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description) -/// -/// ECMAScript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. Previously, no maximum length was specified. -/// -/// In Firefox, strings have a maximum length of 2\*\*30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2\*\*28 - 1 (~256MB). -const MAX_JSON_STR_LEN: usize = usize::pow(2, 30) - 2; - -/// Minimum size JSON needs to be in order to convert it to JSON.parse with [`format_json`]. -// TODO: this number should be benchmarked and checked for optimal range, I set 10 KiB arbitrarily -// we don't want to lose the gained object parsing time to extra allocations preparing it -const MIN_JSON_PARSE_LEN: usize = 10_240; - -/// Transforms & escapes a JSON value. -/// -/// If it's an object or array, JSON.parse('{json}') is used, with the '{json}' string properly escaped. -/// The return value of this function can be safely used on [`eval`](crate::Window#method.eval) calls. -/// -/// Single quotes chosen because double quotes are already used in JSON. With single quotes, we only -/// need to escape strings that include backslashes or single quotes. If we used double quotes, then -/// there would be no cases that a string doesn't need escaping. -/// -/// The function takes a closure to handle the escaped string in order to avoid unnecessary allocations. -/// -/// # Safety -/// -/// The ability to safely escape JSON into a JSON.parse('{json}') relies entirely on 2 things. -/// -/// 1. `serde_json`'s ability to correctly escape and format json into a string. -/// 2. JavaScript engines not accepting anything except another unescaped, literal single quote -/// character to end a string that was opened with it. -fn serialize_js_with String>( - value: &T, - options: serialize_to_javascript::Options, - cb: F, -) -> crate::api::Result { - // get a raw &str representation of a serialized json value. - let string = serde_json::to_string(value)?; - let raw = RawValue::from_string(string)?; - - // from here we know json.len() > 1 because an empty string is not a valid json value. - let json = raw.get(); - let first = json.as_bytes()[0]; - - #[cfg(debug_assertions)] - if first == b'"' { - assert!( - json.len() < MAX_JSON_STR_LEN, - "passing a string larger than the max JavaScript literal string size" - ) - } - - let return_val = if json.len() > MIN_JSON_PARSE_LEN && (first == b'{' || first == b'[') { - let serialized = Serialized::new(&raw, &options).into_string(); - // only use JSON.parse('{arg}') for arrays and objects less than the limit - // smaller literals do not benefit from being parsed from json - if serialized.len() < MAX_JSON_STR_LEN { - cb(&serialized) - } else { - cb(json) - } - } else { - cb(json) - }; - - Ok(return_val) -} - -/// Formats a function name and argument to be evaluated as callback. -/// -/// This will serialize primitive JSON types (e.g. booleans, strings, numbers, etc.) as JavaScript literals, -/// but will serialize arrays and objects whose serialized JSON string is smaller than 1 GB and larger -/// than 10 KiB with `JSON.parse('...')`. -/// See [json-parse-benchmark](https://github.com/GoogleChromeLabs/json-parse-benchmark). -pub fn format(function_name: CallbackFn, arg: &T) -> crate::api::Result { - serialize_js_with(arg, Default::default(), |arg| { - format!( - r#" - if (window["_{fn}"]) {{ - window["_{fn}"]({arg}) - }} else {{ - console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.") - }}"#, - fn = function_name.0 - ) - }) -} - -/// Formats a Result type to its Promise response. -/// Useful for Promises handling. -/// If the Result `is_ok()`, the callback will be the `success_callback` function name and the argument will be the Ok value. -/// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. -/// -/// * `result` the Result to check -/// * `success_callback` the function name of the Ok callback. Usually the `resolve` of the JS Promise. -/// * `error_callback` the function name of the Err callback. Usually the `reject` of the JS Promise. -/// -/// Note that the callback strings are automatically generated by the `invoke` helper. -pub fn format_result( - result: Result, - success_callback: CallbackFn, - error_callback: CallbackFn, -) -> crate::api::Result { - match result { - Ok(res) => format(success_callback, &res), - Err(err) => format(error_callback, &err), - } -} - -#[cfg(test)] -mod test { - use super::*; - use quickcheck::{Arbitrary, Gen}; - use quickcheck_macros::quickcheck; - - impl Arbitrary for CallbackFn { - fn arbitrary(g: &mut Gen) -> CallbackFn { - CallbackFn(usize::arbitrary(g)) - } - } - - fn serialize_js(value: &T) -> crate::api::Result { - serialize_js_with(value, Default::default(), |v| v.into()) - } - - #[test] - fn test_serialize_js() { - assert_eq!(serialize_js(&()).unwrap(), "null"); - assert_eq!(serialize_js(&5i32).unwrap(), "5"); - - #[derive(serde::Serialize)] - struct JsonObj { - value: String, - } - - let raw_str = "T".repeat(MIN_JSON_PARSE_LEN); - assert_eq!(serialize_js(&raw_str).unwrap(), format!("\"{raw_str}\"")); - - assert_eq!( - serialize_js(&JsonObj { - value: raw_str.clone() - }) - .unwrap(), - format!("JSON.parse('{{\"value\":\"{raw_str}\"}}')") - ); - - assert_eq!( - serialize_js(&JsonObj { - value: format!("\"{raw_str}\"") - }) - .unwrap(), - format!("JSON.parse('{{\"value\":\"\\\\\"{raw_str}\\\\\"\"}}')") - ); - - let dangerous_json = RawValue::from_string( - r#"{"test":"don\\🚀🐱‍👤\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don't forget to escape me!","test3":"\\🚀🐱‍👤\\\\'''\\\\🚀🐱‍👤\\\\🚀🐱‍👤\\'''''"}"#.into() - ).unwrap(); - - let definitely_escaped_dangerous_json = format!( - "JSON.parse('{}')", - dangerous_json - .get() - .replace('\\', "\\\\") - .replace('\'', "\\'") - ); - let escape_single_quoted_json_test = - serialize_to_javascript::Serialized::new(&dangerous_json, &Default::default()).into_string(); - - let result = r#"JSON.parse('{"test":"don\\\\🚀🐱‍👤\\\\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don\'t forget to escape me!","test3":"\\\\🚀🐱‍👤\\\\\\\\\'\'\'\\\\\\\\🚀🐱‍👤\\\\\\\\🚀🐱‍👤\\\\\'\'\'\'\'"}')"#; - assert_eq!(definitely_escaped_dangerous_json, result); - assert_eq!(escape_single_quoted_json_test, result); - } - - // check arbitrary strings in the format callback function - #[quickcheck] - fn qc_formatting(f: CallbackFn, a: String) -> bool { - // call format callback - let fc = format(f, &a).unwrap(); - fc.contains(&format!( - r#"window["_{}"](JSON.parse('{}'))"#, - f.0, - serde_json::Value::String(a.clone()), - )) || fc.contains(&format!( - r#"window["_{}"]({})"#, - f.0, - serde_json::Value::String(a), - )) - } - - // check arbitrary strings in format_result - #[quickcheck] - fn qc_format_res(result: Result, c: CallbackFn, ec: CallbackFn) -> bool { - let resp = format_result(result.clone(), c, ec).expect("failed to format callback result"); - let (function, value) = match result { - Ok(v) => (c, v), - Err(e) => (ec, e), - }; - - resp.contains(&format!( - r#"window["_{}"]({})"#, - function.0, - serde_json::Value::String(value), - )) - } -} diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 8ed542e6cfa9..8ec0b479cfd7 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -22,9 +22,6 @@ use crate::{ Runtime, StateManager, Window, }; -#[cfg(target_os = "linux")] -pub(crate) mod format_callback; - /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; @@ -68,29 +65,21 @@ impl Serialize for Channel { impl Channel { /// Sends the given data through the channel. pub fn send(&self, data: T) -> crate::Result<()> { - #[cfg(target_os = "linux")] - { - let js = format_callback::format(self.id, &data.body()?.into_json())?; - self.window.eval(&js) - } - #[cfg(not(target_os = "linux"))] - { - use crate::Manager; - - let body = data.body()?; - let data_id = rand::random(); - self - .window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - self.window.eval(&format!( + use crate::Manager; + + let body = data.body()?; + let data_id = rand::random(); + self + .window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + self.window.eval(&format!( "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", self.id.0 )) - } } } diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index cb9463b87ec1..1fdc77502110 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -588,14 +588,6 @@ impl WindowManager { Ok(pending) } - #[cfg(target_os = "linux")] - fn prepare_ipc_message_handler( - &self, - ) -> crate::runtime::webview::WebviewIpcHandler { - let manager = self.clone(); - Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) - } - fn prepare_ipc_scheme_protocol(&self, label: String) -> UriSchemeProtocolHandler { let manager = self.clone(); Box::new(move |request| { @@ -1135,10 +1127,6 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; - #[cfg(target_os = "linux")] - { - pending.ipc_handler = Some(self.prepare_ipc_message_handler()); - } // in `Windows`, we need to force a data_directory // but we do respect user-specification @@ -1475,69 +1463,6 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } -#[cfg(target_os = "linux")] -fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { - if let Some(window) = manager.get_window(label) { - #[derive(serde::Deserialize)] - struct Message { - cmd: String, - callback: CallbackFn, - error: CallbackFn, - #[serde(flatten)] - payload: serde_json::Value, - } - - #[allow(unused_mut)] - let mut invoke_message: Option> = None; - - #[cfg(feature = "isolation")] - { - #[derive(serde::Deserialize)] - struct IsolationMessage<'a> { - cmd: String, - callback: CallbackFn, - error: CallbackFn, - #[serde(flatten)] - payload: RawIsolationPayload<'a>, - } - - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - invoke_message.replace( - serde_json::from_str::>(&message) - .map_err(Into::into) - .and_then(|message| { - Ok(Message { - cmd: message.cmd, - callback: message.callback, - error: message.error, - payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, - }) - }), - ); - } - } - - match invoke_message - .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) - { - Ok(message) => { - let _ = window.on_message(InvokeRequest { - cmd: message.cmd, - callback: message.callback, - error: message.error, - body: message.payload.into(), - }); - } - Err(e) => { - let _ = window.eval(&format!( - r#"console.error({})"#, - serde_json::Value::String(e.to_string()) - )); - } - } - } -} - fn handle_ipc_request( request: &HttpRequest, manager: &WindowManager, diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 879fb3d78644..a90e5ad37c35 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1706,34 +1706,6 @@ impl Window { Arc::new( #[allow(unused_variables)] move |window, response, callback, error| { - #[cfg(target_os = "linux")] - { - use crate::ipc::format_callback::{ - format as format_callback, format_result as format_callback_result, - }; - if custom_responder.is_none() { - let formatted_js = match &response { - InvokeResponse::Ok(InvokeBody::Json(v)) => { - format_callback_result(Result::<_, ()>::Ok(v), callback, error) - } - InvokeResponse::Ok(InvokeBody::Raw(v)) => { - format_callback_result(Result::<_, ()>::Ok(v), callback, error) - } - InvokeResponse::Err(e) => { - format_callback_result(Result::<(), _>::Err(&e.0), callback, error) - } - }; - - let response_js = match formatted_js { - Ok(response_js) => response_js, - Err(e) => format_callback(error, &e.to_string()) - .expect("unable to serialize response error string to json"), - }; - - let _ = window.eval(&response_js); - } - } - if let Some(responder) = &custom_responder { (responder)(window, &response, callback, error); } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 4a8ba8f75581..46e5f8d2a95b 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -1535,9 +1535,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "javascriptcore-rs" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110b9902c80c12bf113c432d0b71c7a94490b294a8234f326fd0abca2fac0b00" +checksum = "4cfcc681b896b083864a4a3c3b3ea196f14ff66b8641a68fde209c6d84434056" dependencies = [ "bitflags", "glib", @@ -1546,9 +1546,9 @@ dependencies = [ [[package]] name = "javascriptcore-rs-sys" -version = "0.5.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a216519a52cd941a733a0ad3f1023cfdb1cd47f3955e8e863ed56f558f916c" +checksum = "b0983ba5b3ab9a0c0918de02c42dc71f795d6de08092f88a98ce9fdfdee4ba91" dependencies = [ "glib-sys", "gobject-sys", @@ -3633,9 +3633,9 @@ dependencies = [ [[package]] name = "webkit2gtk" -version = "0.19.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eea819afe15eb8dcdff4f19d8bfda540bae84d874c10e6f4b8faf2d6704bd1" +checksum = "3ba4cce9085e0fb02575cfd45c328740dde78253cba516b1e8be2ca0f57bd8bf" dependencies = [ "bitflags", "cairo-rs", @@ -3657,9 +3657,9 @@ dependencies = [ [[package]] name = "webkit2gtk-sys" -version = "0.19.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ac7a95ddd3fdfcaf83d8e513b4b1ad101b95b413b6aa6662ed95f284fc3d5b" +checksum = "f4489eb24e8cf0a3d0555fd3a8f7adec2a5ece34c1e7b7c9a62da7822fd40a59" dependencies = [ "bitflags", "cairo-sys-rs", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wry" version = "0.28.3" -source = "git+https://github.com/tauri-apps/wry?branch=feat/android-protocol-req-body#ce8fc97db23ae74d7dc1234e6d6c85e4235c9e10" +source = "git+https://github.com/tauri-apps/wry?branch=linux-body#4f931fcb3fa090845b1fdaaed9a0f1ec416ae055" dependencies = [ "base64", "block", From 6ca0f313f3b7a7a3b604b4dc664276e7339c41d7 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 10:25:38 -0300 Subject: [PATCH 21/90] Revert "use custom protocol on linux!!!!!!!!" This reverts commit da2d00b2c881163b6a2091ed7889783b6bb0ceaa. --- core/tauri-runtime-wry/Cargo.toml | 4 +- core/tauri-runtime-wry/src/lib.rs | 39 ++++- core/tauri-runtime/src/webview.rs | 5 +- core/tauri-runtime/src/window.rs | 7 +- core/tauri/Cargo.toml | 2 +- core/tauri/scripts/ipc-post-message.js | 13 ++ core/tauri/src/app.rs | 16 ++ core/tauri/src/ipc/format_callback.rs | 216 +++++++++++++++++++++++++ core/tauri/src/ipc/mod.rs | 35 ++-- core/tauri/src/manager.rs | 75 +++++++++ core/tauri/src/window.rs | 28 ++++ examples/api/src-tauri/Cargo.lock | 18 +-- 12 files changed, 430 insertions(+), 28 deletions(-) create mode 100644 core/tauri/scripts/ipc-post-message.js create mode 100644 core/tauri/src/ipc/format_callback.rs diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 791be1887b7c..25ee92bfe069 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { git = "https://github.com/tauri-apps/wry", branch = "linux-body", default-features = false, features = [ "file-drop", "protocol", "linux-body" ] } +wry = { git = "https://github.com/tauri-apps/wry", branch = "feat/android-protocol-req-body", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } @@ -31,7 +31,7 @@ webview2-com = "0.25" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } -webkit2gtk = { version = "1.1", features = [ "v2_40" ] } +webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } percent-encoding = "2.1" [target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies] diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 8ced2b3f9edf..629e72c91c6b 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -7,9 +7,9 @@ use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle}; use tauri_runtime::{ http::{header::CONTENT_TYPE, Request as HttpRequest, RequestParts, Response as HttpResponse}, - menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuItem, MenuUpdate}, + menu::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate}, monitor::Monitor, - webview::{WindowBuilder, WindowBuilderBase}, + webview::{WebviewIpcHandler, WindowBuilder, WindowBuilderBase}, window::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, PendingWindow, WindowEvent, @@ -105,6 +105,7 @@ use std::{ }; pub type WebviewId = u64; +type IpcHandler = dyn Fn(&Window, String) + 'static; type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static; #[cfg(all(desktop, feature = "system-tray"))] pub use tauri_runtime::TrayId; @@ -3001,7 +3002,9 @@ fn create_webview( uri_scheme_protocols, mut window_builder, label, + ipc_handler, url, + menu_ids, #[cfg(target_os = "android")] on_webview_created, .. @@ -3081,6 +3084,15 @@ fn create_webview( } } + if let Some(handler) = ipc_handler { + webview_builder = webview_builder.with_ipc_handler(create_ipc_handler( + context, + label.clone(), + menu_ids, + handler, + )); + } + for (scheme, protocol) in uri_scheme_protocols { webview_builder = webview_builder.with_custom_protocol(scheme, move |wry_request| { protocol(&HttpRequestWrapper::from(wry_request).0) @@ -3199,6 +3211,29 @@ fn create_webview( }) } +/// Create a wry ipc handler from a tauri ipc handler. +fn create_ipc_handler( + context: Context, + label: String, + menu_ids: Arc>>, + handler: WebviewIpcHandler>, +) -> Box { + Box::new(move |window, request| { + let window_id = context.webview_id_map.get(&window.id()).unwrap(); + handler( + DetachedWindow { + dispatcher: WryDispatcher { + window_id, + context: context.clone(), + }, + label: label.clone(), + menu_ids: menu_ids.clone(), + }, + request, + ); + }) +} + /// Create a wry file drop handler. fn create_file_drop_handler(window_event_listeners: WindowEventListeners) -> Box { Box::new(move |_window, event| { diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index e9dd69b66c5a..888c127f5806 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,7 +4,7 @@ //! Items specific to the [`Runtime`](crate::Runtime)'s webview. -use crate::{menu::Menu, Icon}; +use crate::{menu::Menu, window::DetachedWindow, Icon}; #[cfg(target_os = "macos")] use tauri_utils::TitleBarStyle; @@ -331,3 +331,6 @@ pub trait WindowBuilder: WindowBuilderBase { /// Gets the window menu. fn get_menu(&self) -> Option<&Menu>; } + +/// IPC handler. +pub type WebviewIpcHandler = Box, String) + Send>; diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index c9522e1f0fd8..fbb7899f9b92 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -7,7 +7,7 @@ use crate::{ http::{Request as HttpRequest, Response as HttpResponse}, menu::{Menu, MenuEntry, MenuHash, MenuId}, - webview::WebviewAttributes, + webview::{WebviewAttributes, WebviewIpcHandler}, Dispatch, Runtime, UserEvent, WindowBuilder, }; use serde::{Deserialize, Deserializer, Serialize}; @@ -226,6 +226,9 @@ pub struct PendingWindow> { pub uri_scheme_protocols: HashMap>, + /// How to handle IPC calls on the webview window. + pub ipc_handler: Option>, + /// Maps runtime id to a string menu id. pub menu_ids: Arc>>, @@ -276,6 +279,7 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, + ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), @@ -307,6 +311,7 @@ impl> PendingWindow { webview_attributes, uri_scheme_protocols: Default::default(), label, + ipc_handler: None, menu_ids: Arc::new(Mutex::new(menu_ids)), navigation_handler: Default::default(), url: "tauri://localhost".to_string(), diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index bbcb34ae5e6a..839dc1e6cd57 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -73,7 +73,7 @@ ico = { version = "0.2.0", optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } glib = "0.16" -webkit2gtk = { version = "1.1", features = [ "v2_40" ] } +webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } [target."cfg(target_os = \"macos\")".dependencies] embed_plist = "1.2" diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js new file mode 100644 index 000000000000..9b8d5de1c7e7 --- /dev/null +++ b/core/tauri/scripts/ipc-post-message.js @@ -0,0 +1,13 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +(function () { + Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { + value: (message) => { + const { cmd, callback, error, payload } = message + const { data } = __RAW_process_ipc_message_fn__({ cmd, callback, error, ...payload }) + window.ipc.postMessage(data) + } + }) +})() diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index b22b85dfca9f..ffaedd4aff7e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -840,6 +840,14 @@ struct ProtocolInvokeInitializationScript<'a> { process_ipc_message_fn: &'a str, } +#[derive(Template)] +#[default_template("../scripts/ipc-post-message.js")] +struct PostMessageInvokeInitializationScript<'a> { + /// The function that processes the IPC message. + #[raw] + process_ipc_message_fn: &'a str, +} + impl Builder { /// Creates a new App builder. pub fn new() -> Self { @@ -849,6 +857,14 @@ impl Builder { setup: Box::new(|_| Ok(())), invoke_handler: Box::new(|_| false), invoke_responder: None, + #[cfg(target_os = "linux")] + invoke_initialization_script: PostMessageInvokeInitializationScript { + process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, + } + .render_default(&Default::default()) + .unwrap() + .into_string(), + #[cfg(not(target_os = "linux"))] invoke_initialization_script: ProtocolInvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, } diff --git a/core/tauri/src/ipc/format_callback.rs b/core/tauri/src/ipc/format_callback.rs new file mode 100644 index 000000000000..f149567abf1b --- /dev/null +++ b/core/tauri/src/ipc/format_callback.rs @@ -0,0 +1,216 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::Serialize; +use serde_json::value::RawValue; +use serialize_to_javascript::Serialized; + +use super::CallbackFn; + +/// The information about this is quite limited. On Chrome/Edge and Firefox, [the maximum string size is approximately 1 GB](https://stackoverflow.com/a/34958490). +/// +/// [From MDN:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#description) +/// +/// ECMAScript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. Previously, no maximum length was specified. +/// +/// In Firefox, strings have a maximum length of 2\*\*30 - 2 (~1GB). In versions prior to Firefox 65, the maximum length was 2\*\*28 - 1 (~256MB). +const MAX_JSON_STR_LEN: usize = usize::pow(2, 30) - 2; + +/// Minimum size JSON needs to be in order to convert it to JSON.parse with [`format_json`]. +// TODO: this number should be benchmarked and checked for optimal range, I set 10 KiB arbitrarily +// we don't want to lose the gained object parsing time to extra allocations preparing it +const MIN_JSON_PARSE_LEN: usize = 10_240; + +/// Transforms & escapes a JSON value. +/// +/// If it's an object or array, JSON.parse('{json}') is used, with the '{json}' string properly escaped. +/// The return value of this function can be safely used on [`eval`](crate::Window#method.eval) calls. +/// +/// Single quotes chosen because double quotes are already used in JSON. With single quotes, we only +/// need to escape strings that include backslashes or single quotes. If we used double quotes, then +/// there would be no cases that a string doesn't need escaping. +/// +/// The function takes a closure to handle the escaped string in order to avoid unnecessary allocations. +/// +/// # Safety +/// +/// The ability to safely escape JSON into a JSON.parse('{json}') relies entirely on 2 things. +/// +/// 1. `serde_json`'s ability to correctly escape and format json into a string. +/// 2. JavaScript engines not accepting anything except another unescaped, literal single quote +/// character to end a string that was opened with it. +fn serialize_js_with String>( + value: &T, + options: serialize_to_javascript::Options, + cb: F, +) -> crate::api::Result { + // get a raw &str representation of a serialized json value. + let string = serde_json::to_string(value)?; + let raw = RawValue::from_string(string)?; + + // from here we know json.len() > 1 because an empty string is not a valid json value. + let json = raw.get(); + let first = json.as_bytes()[0]; + + #[cfg(debug_assertions)] + if first == b'"' { + assert!( + json.len() < MAX_JSON_STR_LEN, + "passing a string larger than the max JavaScript literal string size" + ) + } + + let return_val = if json.len() > MIN_JSON_PARSE_LEN && (first == b'{' || first == b'[') { + let serialized = Serialized::new(&raw, &options).into_string(); + // only use JSON.parse('{arg}') for arrays and objects less than the limit + // smaller literals do not benefit from being parsed from json + if serialized.len() < MAX_JSON_STR_LEN { + cb(&serialized) + } else { + cb(json) + } + } else { + cb(json) + }; + + Ok(return_val) +} + +/// Formats a function name and argument to be evaluated as callback. +/// +/// This will serialize primitive JSON types (e.g. booleans, strings, numbers, etc.) as JavaScript literals, +/// but will serialize arrays and objects whose serialized JSON string is smaller than 1 GB and larger +/// than 10 KiB with `JSON.parse('...')`. +/// See [json-parse-benchmark](https://github.com/GoogleChromeLabs/json-parse-benchmark). +pub fn format(function_name: CallbackFn, arg: &T) -> crate::api::Result { + serialize_js_with(arg, Default::default(), |arg| { + format!( + r#" + if (window["_{fn}"]) {{ + window["_{fn}"]({arg}) + }} else {{ + console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.") + }}"#, + fn = function_name.0 + ) + }) +} + +/// Formats a Result type to its Promise response. +/// Useful for Promises handling. +/// If the Result `is_ok()`, the callback will be the `success_callback` function name and the argument will be the Ok value. +/// If the Result `is_err()`, the callback will be the `error_callback` function name and the argument will be the Err value. +/// +/// * `result` the Result to check +/// * `success_callback` the function name of the Ok callback. Usually the `resolve` of the JS Promise. +/// * `error_callback` the function name of the Err callback. Usually the `reject` of the JS Promise. +/// +/// Note that the callback strings are automatically generated by the `invoke` helper. +pub fn format_result( + result: Result, + success_callback: CallbackFn, + error_callback: CallbackFn, +) -> crate::api::Result { + match result { + Ok(res) => format(success_callback, &res), + Err(err) => format(error_callback, &err), + } +} + +#[cfg(test)] +mod test { + use super::*; + use quickcheck::{Arbitrary, Gen}; + use quickcheck_macros::quickcheck; + + impl Arbitrary for CallbackFn { + fn arbitrary(g: &mut Gen) -> CallbackFn { + CallbackFn(usize::arbitrary(g)) + } + } + + fn serialize_js(value: &T) -> crate::api::Result { + serialize_js_with(value, Default::default(), |v| v.into()) + } + + #[test] + fn test_serialize_js() { + assert_eq!(serialize_js(&()).unwrap(), "null"); + assert_eq!(serialize_js(&5i32).unwrap(), "5"); + + #[derive(serde::Serialize)] + struct JsonObj { + value: String, + } + + let raw_str = "T".repeat(MIN_JSON_PARSE_LEN); + assert_eq!(serialize_js(&raw_str).unwrap(), format!("\"{raw_str}\"")); + + assert_eq!( + serialize_js(&JsonObj { + value: raw_str.clone() + }) + .unwrap(), + format!("JSON.parse('{{\"value\":\"{raw_str}\"}}')") + ); + + assert_eq!( + serialize_js(&JsonObj { + value: format!("\"{raw_str}\"") + }) + .unwrap(), + format!("JSON.parse('{{\"value\":\"\\\\\"{raw_str}\\\\\"\"}}')") + ); + + let dangerous_json = RawValue::from_string( + r#"{"test":"don\\🚀🐱‍👤\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don't forget to escape me!","test3":"\\🚀🐱‍👤\\\\'''\\\\🚀🐱‍👤\\\\🚀🐱‍👤\\'''''"}"#.into() + ).unwrap(); + + let definitely_escaped_dangerous_json = format!( + "JSON.parse('{}')", + dangerous_json + .get() + .replace('\\', "\\\\") + .replace('\'', "\\'") + ); + let escape_single_quoted_json_test = + serialize_to_javascript::Serialized::new(&dangerous_json, &Default::default()).into_string(); + + let result = r#"JSON.parse('{"test":"don\\\\🚀🐱‍👤\\\\\'t forget to escape me!🚀🐱‍👤","te🚀🐱‍👤st2":"don\'t forget to escape me!","test3":"\\\\🚀🐱‍👤\\\\\\\\\'\'\'\\\\\\\\🚀🐱‍👤\\\\\\\\🚀🐱‍👤\\\\\'\'\'\'\'"}')"#; + assert_eq!(definitely_escaped_dangerous_json, result); + assert_eq!(escape_single_quoted_json_test, result); + } + + // check arbitrary strings in the format callback function + #[quickcheck] + fn qc_formatting(f: CallbackFn, a: String) -> bool { + // call format callback + let fc = format(f, &a).unwrap(); + fc.contains(&format!( + r#"window["_{}"](JSON.parse('{}'))"#, + f.0, + serde_json::Value::String(a.clone()), + )) || fc.contains(&format!( + r#"window["_{}"]({})"#, + f.0, + serde_json::Value::String(a), + )) + } + + // check arbitrary strings in format_result + #[quickcheck] + fn qc_format_res(result: Result, c: CallbackFn, ec: CallbackFn) -> bool { + let resp = format_result(result.clone(), c, ec).expect("failed to format callback result"); + let (function, value) = match result { + Ok(v) => (c, v), + Err(e) => (ec, e), + }; + + resp.contains(&format!( + r#"window["_{}"]({})"#, + function.0, + serde_json::Value::String(value), + )) + } +} diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 8ec0b479cfd7..8ed542e6cfa9 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -22,6 +22,9 @@ use crate::{ Runtime, StateManager, Window, }; +#[cfg(target_os = "linux")] +pub(crate) mod format_callback; + /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; @@ -65,21 +68,29 @@ impl Serialize for Channel { impl Channel { /// Sends the given data through the channel. pub fn send(&self, data: T) -> crate::Result<()> { - use crate::Manager; - - let body = data.body()?; - let data_id = rand::random(); - self - .window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - self.window.eval(&format!( + #[cfg(target_os = "linux")] + { + let js = format_callback::format(self.id, &data.body()?.into_json())?; + self.window.eval(&js) + } + #[cfg(not(target_os = "linux"))] + { + use crate::Manager; + + let body = data.body()?; + let data_id = rand::random(); + self + .window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + self.window.eval(&format!( "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", self.id.0 )) + } } } diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 1fdc77502110..cb9463b87ec1 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -588,6 +588,14 @@ impl WindowManager { Ok(pending) } + #[cfg(target_os = "linux")] + fn prepare_ipc_message_handler( + &self, + ) -> crate::runtime::webview::WebviewIpcHandler { + let manager = self.clone(); + Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) + } + fn prepare_ipc_scheme_protocol(&self, label: String) -> UriSchemeProtocolHandler { let manager = self.clone(); Box::new(move |request| { @@ -1127,6 +1135,10 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; + #[cfg(target_os = "linux")] + { + pending.ipc_handler = Some(self.prepare_ipc_message_handler()); + } // in `Windows`, we need to force a data_directory // but we do respect user-specification @@ -1463,6 +1475,69 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } +#[cfg(target_os = "linux")] +fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { + if let Some(window) = manager.get_window(label) { + #[derive(serde::Deserialize)] + struct Message { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: serde_json::Value, + } + + #[allow(unused_mut)] + let mut invoke_message: Option> = None; + + #[cfg(feature = "isolation")] + { + #[derive(serde::Deserialize)] + struct IsolationMessage<'a> { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: RawIsolationPayload<'a>, + } + + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + invoke_message.replace( + serde_json::from_str::>(&message) + .map_err(Into::into) + .and_then(|message| { + Ok(Message { + cmd: message.cmd, + callback: message.callback, + error: message.error, + payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, + }) + }), + ); + } + } + + match invoke_message + .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) + { + Ok(message) => { + let _ = window.on_message(InvokeRequest { + cmd: message.cmd, + callback: message.callback, + error: message.error, + body: message.payload.into(), + }); + } + Err(e) => { + let _ = window.eval(&format!( + r#"console.error({})"#, + serde_json::Value::String(e.to_string()) + )); + } + } + } +} + fn handle_ipc_request( request: &HttpRequest, manager: &WindowManager, diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index a90e5ad37c35..879fb3d78644 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1706,6 +1706,34 @@ impl Window { Arc::new( #[allow(unused_variables)] move |window, response, callback, error| { + #[cfg(target_os = "linux")] + { + use crate::ipc::format_callback::{ + format as format_callback, format_result as format_callback_result, + }; + if custom_responder.is_none() { + let formatted_js = match &response { + InvokeResponse::Ok(InvokeBody::Json(v)) => { + format_callback_result(Result::<_, ()>::Ok(v), callback, error) + } + InvokeResponse::Ok(InvokeBody::Raw(v)) => { + format_callback_result(Result::<_, ()>::Ok(v), callback, error) + } + InvokeResponse::Err(e) => { + format_callback_result(Result::<(), _>::Err(&e.0), callback, error) + } + }; + + let response_js = match formatted_js { + Ok(response_js) => response_js, + Err(e) => format_callback(error, &e.to_string()) + .expect("unable to serialize response error string to json"), + }; + + let _ = window.eval(&response_js); + } + } + if let Some(responder) = &custom_responder { (responder)(window, &response, callback, error); } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 46e5f8d2a95b..4a8ba8f75581 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -1535,9 +1535,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "javascriptcore-rs" -version = "1.0.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cfcc681b896b083864a4a3c3b3ea196f14ff66b8641a68fde209c6d84434056" +checksum = "110b9902c80c12bf113c432d0b71c7a94490b294a8234f326fd0abca2fac0b00" dependencies = [ "bitflags", "glib", @@ -1546,9 +1546,9 @@ dependencies = [ [[package]] name = "javascriptcore-rs-sys" -version = "1.0.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0983ba5b3ab9a0c0918de02c42dc71f795d6de08092f88a98ce9fdfdee4ba91" +checksum = "98a216519a52cd941a733a0ad3f1023cfdb1cd47f3955e8e863ed56f558f916c" dependencies = [ "glib-sys", "gobject-sys", @@ -3633,9 +3633,9 @@ dependencies = [ [[package]] name = "webkit2gtk" -version = "1.1.0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba4cce9085e0fb02575cfd45c328740dde78253cba516b1e8be2ca0f57bd8bf" +checksum = "d8eea819afe15eb8dcdff4f19d8bfda540bae84d874c10e6f4b8faf2d6704bd1" dependencies = [ "bitflags", "cairo-rs", @@ -3657,9 +3657,9 @@ dependencies = [ [[package]] name = "webkit2gtk-sys" -version = "1.1.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4489eb24e8cf0a3d0555fd3a8f7adec2a5ece34c1e7b7c9a62da7822fd40a59" +checksum = "d0ac7a95ddd3fdfcaf83d8e513b4b1ad101b95b413b6aa6662ed95f284fc3d5b" dependencies = [ "bitflags", "cairo-sys-rs", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wry" version = "0.28.3" -source = "git+https://github.com/tauri-apps/wry?branch=linux-body#4f931fcb3fa090845b1fdaaed9a0f1ec416ae055" +source = "git+https://github.com/tauri-apps/wry?branch=feat/android-protocol-req-body#ce8fc97db23ae74d7dc1234e6d6c85e4235c9e10" dependencies = [ "base64", "block", From e5397d33aa851ee5f867d2c178e383d305c16dbe Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 14:48:18 -0300 Subject: [PATCH 22/90] feature flag for linux body, use protocol to send big responses --- core/tauri-runtime-wry/Cargo.toml | 5 +- core/tauri/Cargo.toml | 3 +- core/tauri/build.rs | 5 ++ core/tauri/scripts/ipc-post-message.js | 13 --- core/tauri/scripts/ipc-protocol.js | 63 ++++++++------ core/tauri/src/app.rs | 22 +---- core/tauri/src/ipc/mod.rs | 87 +++++++++++-------- core/tauri/src/lib.rs | 1 + core/tauri/src/manager.rs | 13 ++- core/tauri/src/window.rs | 111 +++++++++++++++---------- examples/api/src-tauri/Cargo.lock | 18 ++-- 11 files changed, 185 insertions(+), 156 deletions(-) delete mode 100644 core/tauri/scripts/ipc-post-message.js diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 25ee92bfe069..f1cbba60022c 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { git = "https://github.com/tauri-apps/wry", branch = "feat/android-protocol-req-body", default-features = false, features = [ "file-drop", "protocol", "linux-headers" ] } +wry = { git = "https://github.com/tauri-apps/wry", branch = "linux-body", default-features = false, features = [ "file-drop", "protocol" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } @@ -31,7 +31,7 @@ webview2-com = "0.25" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } -webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } +webkit2gtk = { version = "1.1", features = [ "v2_38" ] } percent-encoding = "2.1" [target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies] @@ -50,3 +50,4 @@ macos-private-api = [ "tauri-runtime/macos-private-api" ] objc-exception = [ "wry/objc-exception" ] +linux-protocol-body = [ "wry/linux-body", "webkit2gtk/v2_40" ] diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 839dc1e6cd57..ca644a51fee2 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -73,7 +73,7 @@ ico = { version = "0.2.0", optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.16", features = [ "v3_24" ] } glib = "0.16" -webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] } +webkit2gtk = { version = "1.1", features = [ "v2_38" ] } [target."cfg(target_os = \"macos\")".dependencies] embed_plist = "1.2" @@ -120,6 +120,7 @@ default = [ "wry", "compression", "objc-exception" ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = [ "tauri-runtime-wry" ] objc-exception = [ "tauri-runtime-wry/objc-exception" ] +linux-protocol-body = [ "tauri-runtime-wry/linux-protocol-body", "webkit2gtk/v2_40" ] isolation = [ "tauri-utils/isolation", "tauri-macros/isolation" ] custom-protocol = [ "tauri-macros/custom-protocol" ] native-tls = [ "reqwest/native-tls" ] diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 29ea69f97a24..2427c2026947 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -50,6 +50,11 @@ fn main() { alias("desktop", !mobile); alias("mobile", mobile); + alias( + "ipc_custom_protocol", + target_os != "linux" || has_feature("linux-protocol-body"), + ); + let checked_features_out_path = Path::new(&var("OUT_DIR").unwrap()).join("checked_features"); std::fs::write( checked_features_out_path, diff --git a/core/tauri/scripts/ipc-post-message.js b/core/tauri/scripts/ipc-post-message.js deleted file mode 100644 index 9b8d5de1c7e7..000000000000 --- a/core/tauri/scripts/ipc-post-message.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -(function () { - Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { - value: (message) => { - const { cmd, callback, error, payload } = message - const { data } = __RAW_process_ipc_message_fn__({ cmd, callback, error, ...payload }) - window.ipc.postMessage(data) - } - }) -})() diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 5c4023a0990c..2227586d9680 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -3,36 +3,45 @@ // SPDX-License-Identifier: MIT (function () { + const processIpcMessage = __RAW_process_ipc_message_fn__ + Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload } = message - const { contentType, data } = __RAW_process_ipc_message_fn__(payload) - fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { - method: 'POST', - body: data, - headers: { - 'Content-Type': contentType, - 'Tauri-Callback': callback, - 'Tauri-Error': error, - } - }).then((response) => { - const cb = response.ok ? callback : error - // we need to split here because on Android the content-type gets duplicated - switch ((response.headers.get('content-type') || '').split(',')[0]) { - case 'application/json': - return response.json().then((r) => [cb, r]) - case 'text/plain': - return response.text().then((r) => [cb, r]) - default: - return response.arrayBuffer().then((r) => [cb, r]) - } - }).then(([cb, data]) => { - if (window[`_${cb}`]) { - window[`_${cb}`](data) - } else { - console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) - } - }) + if (navigator.appVersion.includes('Linux') && !cmd.startsWith('__tauriFetchChannelData__:')) { + const { data } = processIpcMessage({ cmd, callback, error, ...payload }) + window.ipc.postMessage(data) + } else { + const { contentType, data } = processIpcMessage(payload) + let i = new Date() + fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { + method: 'POST', + body: data, + headers: { + 'Content-Type': contentType, + 'Tauri-Callback': callback, + 'Tauri-Error': error, + } + }).then((response) => { + i = new Date() + const cb = response.ok ? callback : error + // we need to split here because on Android the content-type gets duplicated + switch ((response.headers.get('content-type') || '').split(',')[0]) { + case 'application/json': + return response.json().then((r) => [cb, r]) + case 'text/plain': + return response.text().then((r) => [cb, r]) + default: + return response.arrayBuffer().then((r) => [cb, r]) + } + }).then(([cb, data]) => { + if (window[`_${cb}`]) { + window[`_${cb}`](data) + } else { + console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) + } + }) + } } }) })() diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index ffaedd4aff7e..ae8f81bb184e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -834,15 +834,7 @@ pub struct Builder { #[derive(Template)] #[default_template("../scripts/ipc-protocol.js")] -struct ProtocolInvokeInitializationScript<'a> { - /// The function that processes the IPC message. - #[raw] - process_ipc_message_fn: &'a str, -} - -#[derive(Template)] -#[default_template("../scripts/ipc-post-message.js")] -struct PostMessageInvokeInitializationScript<'a> { +struct InvokeInitializationScript<'a> { /// The function that processes the IPC message. #[raw] process_ipc_message_fn: &'a str, @@ -857,15 +849,7 @@ impl Builder { setup: Box::new(|_| Ok(())), invoke_handler: Box::new(|_| false), invoke_responder: None, - #[cfg(target_os = "linux")] - invoke_initialization_script: PostMessageInvokeInitializationScript { - process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, - } - .render_default(&Default::default()) - .unwrap() - .into_string(), - #[cfg(not(target_os = "linux"))] - invoke_initialization_script: ProtocolInvokeInitializationScript { + invoke_initialization_script: InvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, } .render_default(&Default::default()) @@ -933,7 +917,7 @@ impl Builder { #[must_use] pub fn invoke_system(mut self, initialization_script: String, responder: F) -> Self where - F: Fn(Window, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, + F: Fn(Window, String, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, { self.invoke_initialization_script = initialization_script; self.invoke_responder.replace(Arc::new(responder)); diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 8ed542e6cfa9..9025e01dfb8d 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -22,7 +22,7 @@ use crate::{ Runtime, StateManager, Window, }; -#[cfg(target_os = "linux")] +#[cfg(not(ipc_custom_protocol))] pub(crate) mod format_callback; /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. @@ -30,12 +30,12 @@ pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; /// A closure that is responsible for respond a JS message. pub type InvokeResponder = - dyn Fn(Window, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; + dyn Fn(Window, String, &InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; type OwnedInvokeResponder = - dyn Fn(Window, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; + dyn Fn(Window, String, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; const CHANNEL_PREFIX: &str = "__CHANNEL__:"; -pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "__tauriFetchChannelData__"; +pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "__tauriFetchChannelData__:"; #[derive(Default)] pub(crate) struct ChannelDataCache(pub(crate) Mutex>); @@ -66,31 +66,27 @@ impl Serialize for Channel { } impl Channel { + pub(crate) fn new(window: Window, id: CallbackFn) -> Self { + Self { window, id } + } + /// Sends the given data through the channel. pub fn send(&self, data: T) -> crate::Result<()> { - #[cfg(target_os = "linux")] - { - let js = format_callback::format(self.id, &data.body()?.into_json())?; - self.window.eval(&js) - } - #[cfg(not(target_os = "linux"))] - { - use crate::Manager; - - let body = data.body()?; - let data_id = rand::random(); - self - .window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - self.window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', {{ id: {data_id} }}).then(window['_' + {}])", - self.id.0 - )) - } + use crate::Manager; + + let body = data.body()?; + let data_id = rand::random(); + self + .window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + self.window.eval(&format!( + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", + self.id.0 + )) } } @@ -106,14 +102,12 @@ impl<'de, R: Runtime> CommandArg<'de, R> for Channel { .split_once(CHANNEL_PREFIX) .and_then(|(_prefix, id)| id.parse().ok()) { - return Ok(Channel { - id: CallbackFn(callback_id), - window, - }); + Ok(Channel::new(window, CallbackFn(callback_id))) + } else { + Err(InvokeError::from_anyhow(anyhow::anyhow!( + "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" + ))) } - Err(InvokeError::from_anyhow(anyhow::anyhow!( - "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" - ))) } } @@ -301,6 +295,7 @@ impl From for InvokeResponse { pub struct InvokeResolver { window: Window, responder: Arc>, + cmd: String, pub(crate) callback: CallbackFn, pub(crate) error: CallbackFn, } @@ -310,6 +305,7 @@ impl Clone for InvokeResolver { Self { window: self.window.clone(), responder: self.responder.clone(), + cmd: self.cmd.clone(), callback: self.callback, error: self.error, } @@ -320,12 +316,14 @@ impl InvokeResolver { pub(crate) fn new( window: Window, responder: Arc>, + cmd: String, callback: CallbackFn, error: CallbackFn, ) -> Self { Self { window, responder, + cmd, callback, error, } @@ -338,7 +336,15 @@ impl InvokeResolver { F: Future> + Send + 'static, { crate::async_runtime::spawn(async move { - Self::return_task(self.window, self.responder, task, self.callback, self.error).await; + Self::return_task( + self.window, + self.responder, + task, + self.cmd, + self.callback, + self.error, + ) + .await; }); } @@ -356,6 +362,7 @@ impl InvokeResolver { self.window, self.responder, response, + self.cmd, self.callback, self.error, ) @@ -368,6 +375,7 @@ impl InvokeResolver { self.window, self.responder, value.into(), + self.cmd, self.callback, self.error, ) @@ -384,6 +392,7 @@ impl InvokeResolver { self.window, self.responder, Result::<(), _>::Err(value).into(), + self.cmd, self.callback, self.error, ) @@ -395,6 +404,7 @@ impl InvokeResolver { self.window, self.responder, error.into(), + self.cmd, self.callback, self.error, ) @@ -409,6 +419,7 @@ impl InvokeResolver { window: Window, responder: Arc>, task: F, + cmd: String, success_callback: CallbackFn, error_callback: CallbackFn, ) where @@ -420,6 +431,7 @@ impl InvokeResolver { window, responder, || result, + cmd, success_callback, error_callback, ) @@ -429,6 +441,7 @@ impl InvokeResolver { window: Window, responder: Arc>, f: F, + cmd: String, success_callback: CallbackFn, error_callback: CallbackFn, ) { @@ -436,6 +449,7 @@ impl InvokeResolver { window, responder, f().into(), + cmd, success_callback, error_callback, ) @@ -445,10 +459,11 @@ impl InvokeResolver { window: Window, responder: Arc>, response: InvokeResponse, + cmd: String, success_callback: CallbackFn, error_callback: CallbackFn, ) { - (responder)(window, response, success_callback, error_callback); + (responder)(window, cmd, response, success_callback, error_callback); } } diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 044f9aa5152f..e4d052dbd2aa 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -13,6 +13,7 @@ //! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime. //! - **dox**: Internal feature to generate Rust documentation without linking on Linux. //! - **objc-exception**: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust. +//! - **linux-protocol-body**: Enables request body for custom protocol on Linux. Requires webkit2gtk v2.40 or above. //! - **isolation**: Enables the isolation pattern. Enabled by default if the `tauri > pattern > use` config option is set to `isolation` on the `tauri.conf.json` file. //! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one. //! - **devtools**: Enables the developer tools (Web inspector) and [`Window::open_devtools`]. Enabled by default on debug builds. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index cb9463b87ec1..3399bb53e828 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -588,7 +588,7 @@ impl WindowManager { Ok(pending) } - #[cfg(target_os = "linux")] + #[cfg(not(ipc_custom_protocol))] fn prepare_ipc_message_handler( &self, ) -> crate::runtime::webview::WebviewIpcHandler { @@ -1135,7 +1135,7 @@ impl WindowManager { #[allow(clippy::redundant_clone)] app_handle.clone(), )?; - #[cfg(target_os = "linux")] + #[cfg(not(ipc_custom_protocol))] { pending.ipc_handler = Some(self.prepare_ipc_message_handler()); } @@ -1475,7 +1475,7 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } -#[cfg(target_os = "linux")] +#[cfg(not(ipc_custom_protocol))] fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { if let Some(window) = manager.get_window(label) { #[derive(serde::Deserialize)] @@ -1560,7 +1560,8 @@ fn handle_ipc_request( .decode_utf8_lossy() .to_string(); - #[cfg(feature = "isolation")] + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + #[cfg(all(feature = "isolation", ipc_custom_protocol))] if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { match RawIsolationPayload::try_from(&body).and_then(|raw| crypto_keys.decrypt(raw)) { Ok(data) => body = data, @@ -1598,6 +1599,10 @@ fn handle_ipc_request( .unwrap_or("application/octet-stream"); let body = match content_type { "application/octet-stream" => body.into(), + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + #[cfg(not(ipc_custom_protocol))] + "application/json" => serde_json::Value::Object(Default::default()).into(), + #[cfg(ipc_custom_protocol)] "application/json" => serde_json::from_slice::(&body) .map_err(|e| e.to_string())? .into(), diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 879fb3d78644..9e2f1ab57031 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -18,7 +18,7 @@ use crate::{ event::{Event, EventHandler}, ipc::{ CallbackFn, ChannelDataCache, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, - InvokeResponse, FETCH_CHANNEL_DATA_COMMAND, + InvokeResponse, FETCH_CHANNEL_DATA_COMMAND_PREFIX, }, manager::WindowManager, runtime::{ @@ -46,7 +46,7 @@ use crate::{ CursorIcon, Icon, }; -use serde::{Deserialize, Serialize}; +use serde::Serialize; #[cfg(windows)] use windows::Win32::Foundation::HWND; @@ -1705,42 +1705,65 @@ impl Window { self.clone(), Arc::new( #[allow(unused_variables)] - move |window, response, callback, error| { - #[cfg(target_os = "linux")] + move |window: Window, cmd, response, callback, error| { + #[cfg(not(ipc_custom_protocol))] { - use crate::ipc::format_callback::{ - format as format_callback, format_result as format_callback_result, + use crate::ipc::{ + format_callback::{ + format as format_callback, format_result as format_callback_result, + }, + Channel, }; - if custom_responder.is_none() { - let formatted_js = match &response { + use serde_json::Value as JsonValue; + + // the channel data command is the only command that uses a custom protocol on Linux + if custom_responder.is_none() && !cmd.starts_with(FETCH_CHANNEL_DATA_COMMAND_PREFIX) { + fn responder_eval( + window: &Window, + js: crate::api::Result, + error: CallbackFn, + ) { + let eval_js = match js { + Ok(js) => js, + Err(e) => format_callback(error, &e.to_string()) + .expect("unable to serialize response error string to json"), + }; + + let _ = window.eval(&eval_js); + } + + match &response { InvokeResponse::Ok(InvokeBody::Json(v)) => { - format_callback_result(Result::<_, ()>::Ok(v), callback, error) + if matches!(v, JsonValue::Object(_) | JsonValue::Array(_)) { + let _ = Channel::new(window.clone(), callback).send(v); + } else { + responder_eval( + &window, + format_callback_result(Result::<_, ()>::Ok(v), callback, error), + error, + ) + } } InvokeResponse::Ok(InvokeBody::Raw(v)) => { - format_callback_result(Result::<_, ()>::Ok(v), callback, error) - } - InvokeResponse::Err(e) => { - format_callback_result(Result::<(), _>::Err(&e.0), callback, error) + let _ = Channel::new(window.clone(), callback).send(InvokeBody::Raw(v.clone())); } - }; - - let response_js = match formatted_js { - Ok(response_js) => response_js, - Err(e) => format_callback(error, &e.to_string()) - .expect("unable to serialize response error string to json"), - }; - - let _ = window.eval(&response_js); + InvokeResponse::Err(e) => responder_eval( + &window, + format_callback_result(Result::<(), _>::Err(&e.0), callback, error), + error, + ), + } } } if let Some(responder) = &custom_responder { - (responder)(window, &response, callback, error); + (responder)(window, cmd, &response, callback, error); } tx.send(response).unwrap(); }, ), + request.cmd.clone(), request.callback, request.error, ); @@ -1753,30 +1776,28 @@ impl Window { } Err(e) => resolver.reject(e.to_string()), }, - FETCH_CHANNEL_DATA_COMMAND => { - #[derive(Deserialize)] - struct FetchChannelDataPayload { - id: u32, - } - - match request.body.deserialize::() { - Ok(payload) => { - if let Some(data) = self - .state::() - .0 - .lock() - .unwrap() - .remove(&payload.id) - { - resolver.resolve(data); - } else { - resolver.reject("Data not found"); - } + _ => { + // send channel data + if let Some(id) = request + .cmd + .split_once(FETCH_CHANNEL_DATA_COMMAND_PREFIX) + .and_then(|(_, id)| id.parse().ok()) + { + if let Some(data) = self + .state::() + .0 + .lock() + .unwrap() + .remove(&id) + { + resolver.resolve(data); + } else { + resolver.reject("Data not found"); } - Err(e) => resolver.reject(e.to_string()), + + return rx; } - } - _ => { + #[cfg(mobile)] let app_handle = self.app_handle.clone(); diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 4a8ba8f75581..13dd2c13d691 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -1535,9 +1535,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "javascriptcore-rs" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110b9902c80c12bf113c432d0b71c7a94490b294a8234f326fd0abca2fac0b00" +checksum = "4cfcc681b896b083864a4a3c3b3ea196f14ff66b8641a68fde209c6d84434056" dependencies = [ "bitflags", "glib", @@ -1546,9 +1546,9 @@ dependencies = [ [[package]] name = "javascriptcore-rs-sys" -version = "0.5.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a216519a52cd941a733a0ad3f1023cfdb1cd47f3955e8e863ed56f558f916c" +checksum = "b0983ba5b3ab9a0c0918de02c42dc71f795d6de08092f88a98ce9fdfdee4ba91" dependencies = [ "glib-sys", "gobject-sys", @@ -3633,9 +3633,9 @@ dependencies = [ [[package]] name = "webkit2gtk" -version = "0.19.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eea819afe15eb8dcdff4f19d8bfda540bae84d874c10e6f4b8faf2d6704bd1" +checksum = "3ba4cce9085e0fb02575cfd45c328740dde78253cba516b1e8be2ca0f57bd8bf" dependencies = [ "bitflags", "cairo-rs", @@ -3657,9 +3657,9 @@ dependencies = [ [[package]] name = "webkit2gtk-sys" -version = "0.19.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ac7a95ddd3fdfcaf83d8e513b4b1ad101b95b413b6aa6662ed95f284fc3d5b" +checksum = "f4489eb24e8cf0a3d0555fd3a8f7adec2a5ece34c1e7b7c9a62da7822fd40a59" dependencies = [ "bitflags", "cairo-sys-rs", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wry" version = "0.28.3" -source = "git+https://github.com/tauri-apps/wry?branch=feat/android-protocol-req-body#ce8fc97db23ae74d7dc1234e6d6c85e4235c9e10" +source = "git+https://github.com/tauri-apps/wry?branch=linux-body#1ca7a808d188e7f9b9b11c9ae55fa81cb7c95fdc" dependencies = [ "base64", "block", From e4526d1b29284d089088e384c679b2f3a7e239b1 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 14:48:47 -0300 Subject: [PATCH 23/90] fix isIsolationMessage check when payload is empty --- core/tauri-utils/src/pattern/isolation.js | 13 ++++++++----- core/tauri/scripts/ipc.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 3b873ddf2c7f..acb638feeeaf 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -62,11 +62,14 @@ * @return {boolean} - if the event was a valid isolation message */ function isIsolationMessage(data) { - return ( - typeof data === 'object' && - typeof data.payload === 'object' && - Object.keys(data.payload).every((key) => key === 'nonce' || key === 'payload') - ) + if (typeof data === 'object' && typeof data.payload === 'object') { + const keys = Object.keys(data.payload) + return ( + keys.length > 0 && + keys.every((key) => key === 'nonce' || key === 'payload') + ) + } + return false } /** diff --git a/core/tauri/scripts/ipc.js b/core/tauri/scripts/ipc.js index 6bd4a37eb94b..433eba1e5db4 100644 --- a/core/tauri/scripts/ipc.js +++ b/core/tauri/scripts/ipc.js @@ -33,11 +33,14 @@ * @return {boolean} - if the event was a valid isolation message */ function isIsolationMessage(event) { - return ( - typeof event.data === 'object' && - typeof event.data.payload === 'object' && - Object.keys(event.data.payload).every((key) => key === 'nonce' || key === 'payload') - ) + if (typeof event.data === 'object' && typeof event.data.payload === 'object') { + const keys = Object.keys(event.data.payload) + return ( + keys.length > 0 && + keys.every((key) => key === 'nonce' || key === 'payload') + ) + } + return false } /** From 675bdaaa3e8ef5bf9e0751e3449b130ab9dc6bfc Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 14:51:29 -0300 Subject: [PATCH 24/90] rename feature to linux-ipc-protocol --- core/tauri/Cargo.toml | 2 +- core/tauri/build.rs | 2 +- core/tauri/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index ca644a51fee2..7fb23667a6e3 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -120,7 +120,7 @@ default = [ "wry", "compression", "objc-exception" ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = [ "tauri-runtime-wry" ] objc-exception = [ "tauri-runtime-wry/objc-exception" ] -linux-protocol-body = [ "tauri-runtime-wry/linux-protocol-body", "webkit2gtk/v2_40" ] +linux-ipc-protocol = [ "tauri-runtime-wry/linux-protocol-body", "webkit2gtk/v2_40" ] isolation = [ "tauri-utils/isolation", "tauri-macros/isolation" ] custom-protocol = [ "tauri-macros/custom-protocol" ] native-tls = [ "reqwest/native-tls" ] diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 2427c2026947..559408dcf5b6 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -52,7 +52,7 @@ fn main() { alias( "ipc_custom_protocol", - target_os != "linux" || has_feature("linux-protocol-body"), + target_os != "linux" || has_feature("linux-ipc-protocol"), ); let checked_features_out_path = Path::new(&var("OUT_DIR").unwrap()).join("checked_features"); diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index e4d052dbd2aa..1baea428b571 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -13,7 +13,7 @@ //! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime. //! - **dox**: Internal feature to generate Rust documentation without linking on Linux. //! - **objc-exception**: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust. -//! - **linux-protocol-body**: Enables request body for custom protocol on Linux. Requires webkit2gtk v2.40 or above. +//! - **linux-ipc-protocol**: Use custom protocol for faster IPC on Linux. Requires webkit2gtk v2.40 or above. //! - **isolation**: Enables the isolation pattern. Enabled by default if the `tauri > pattern > use` config option is set to `isolation` on the `tauri.conf.json` file. //! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one. //! - **devtools**: Enables the developer tools (Web inspector) and [`Window::open_devtools`]. Enabled by default on debug builds. From 537243663e975ff4376a366a8654f3bb32a1c0fd Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 14:58:16 -0300 Subject: [PATCH 25/90] fix ipc JS script with linux-ipc-protocol feature flag --- core/tauri/scripts/ipc-protocol.js | 2 +- core/tauri/src/app.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 2227586d9680..c6093aba9b14 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -8,7 +8,7 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload } = message - if (navigator.appVersion.includes('Linux') && !cmd.startsWith('__tauriFetchChannelData__:')) { + if (__RAW_use_post_message_condition__) { const { data } = processIpcMessage({ cmd, callback, error, ...payload }) window.ipc.postMessage(data) } else { diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index ae8f81bb184e..cc4e85c4e6db 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -838,6 +838,8 @@ struct InvokeInitializationScript<'a> { /// The function that processes the IPC message. #[raw] process_ipc_message_fn: &'a str, + #[raw] + use_post_message_condition: &'a str, } impl Builder { @@ -851,6 +853,10 @@ impl Builder { invoke_responder: None, invoke_initialization_script: InvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, + #[cfg(ipc_custom_protocol)] + use_post_message_condition: "false", + #[cfg(not(ipc_custom_protocol))] + use_post_message_condition: &format!("navigator.appVersion.includes('Linux') && !cmd.startsWith('{}')", crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX) } .render_default(&Default::default()) .unwrap() From b35210b022b83aedbaa4d659c8c0995fd7d973fc Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 15:01:02 -0300 Subject: [PATCH 26/90] fmt --- core/tauri/src/app.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index cc4e85c4e6db..75e07b2517b4 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -856,7 +856,10 @@ impl Builder { #[cfg(ipc_custom_protocol)] use_post_message_condition: "false", #[cfg(not(ipc_custom_protocol))] - use_post_message_condition: &format!("navigator.appVersion.includes('Linux') && !cmd.startsWith('{}')", crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX) + use_post_message_condition: &format!( + "navigator.appVersion.includes('Linux') && !cmd.startsWith('{}')", + crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX + ), } .render_default(&Default::default()) .unwrap() From c3306c04aeceea88057770cb6e6dc6e423e84fef Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 15:01:36 -0300 Subject: [PATCH 27/90] update lockfile --- tooling/cli/Cargo.lock | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index c83bb4688350..ef33a518afba 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -3968,7 +3968,7 @@ dependencies = [ "toml", "url", "walkdir", - "windows 0.44.0", + "windows 0.48.0", ] [[package]] @@ -4667,23 +4667,14 @@ dependencies = [ "windows_x86_64_msvc 0.39.0", ] -[[package]] -name = "windows" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" -dependencies = [ - "windows-implement 0.44.0", - "windows-interface", - "windows-targets 0.42.2", -] - [[package]] name = "windows" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ + "windows-implement 0.48.0", + "windows-interface", "windows-targets 0.48.0", ] @@ -4699,9 +4690,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" dependencies = [ "proc-macro2", "quote", @@ -4710,9 +4701,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" dependencies = [ "proc-macro2", "quote", From 307af2c6d63924121759a441a6942b51335b449f Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 18:03:51 -0300 Subject: [PATCH 28/90] move protocol handlers to separate module --- core/tauri/src/ipc/mod.rs | 1 + core/tauri/src/ipc/protocol.rs | 231 ++++++++++++++++++++++++++++++++ core/tauri/src/manager.rs | 232 +-------------------------------- 3 files changed, 236 insertions(+), 228 deletions(-) create mode 100644 core/tauri/src/ipc/protocol.rs diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 9025e01dfb8d..26d8f659a4c5 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -24,6 +24,7 @@ use crate::{ #[cfg(not(ipc_custom_protocol))] pub(crate) mod format_callback; +pub(crate) mod protocol; /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs new file mode 100644 index 000000000000..d11534a720ab --- /dev/null +++ b/core/tauri/src/ipc/protocol.rs @@ -0,0 +1,231 @@ +use http::{ + header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN}, + HeaderValue, Method, StatusCode, +}; + +use crate::{ + manager::WindowManager, + runtime::http::{Request as HttpRequest, Response as HttpResponse}, + window::{InvokeRequest, UriSchemeProtocolHandler}, + Runtime, +}; + +use super::{CallbackFn, InvokeBody, InvokeResponse}; + +#[cfg(not(ipc_custom_protocol))] +pub fn message_handler( + manager: WindowManager, +) -> crate::runtime::webview::WebviewIpcHandler { + Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) +} + +pub fn get(manager: WindowManager, label: String) -> UriSchemeProtocolHandler { + Box::new(move |request| { + let mut response = match *request.method() { + Method::POST => { + let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { + Ok(data) => match data { + InvokeResponse::Ok(InvokeBody::Json(v)) => ( + HttpResponse::new(serde_json::to_vec(&v)?.into()), + "application/json", + ), + InvokeResponse::Ok(InvokeBody::Raw(v)) => { + (HttpResponse::new(v.into()), "application/octet-stream") + } + InvokeResponse::Err(e) => { + let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }, + Err(e) => { + let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); + response.set_status(StatusCode::BAD_REQUEST); + (response, "text/plain") + } + }; + + response.set_mimetype(Some(content_type.into())); + + response + } + + Method::OPTIONS => { + let mut r = HttpResponse::new(Vec::new().into()); + r.headers_mut().insert( + ACCESS_CONTROL_ALLOW_HEADERS, + HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error"), + ); + r + } + + _ => { + let mut r = HttpResponse::new( + "only POST and OPTIONS are allowed" + .as_bytes() + .to_vec() + .into(), + ); + r.set_status(StatusCode::METHOD_NOT_ALLOWED); + r.set_mimetype(Some("text/plain".into())); + r + } + }; + + response + .headers_mut() + .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); + + Ok(response) + }) +} + +#[cfg(not(ipc_custom_protocol))] +fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { + if let Some(window) = manager.get_window(label) { + #[derive(serde::Deserialize)] + struct Message { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: serde_json::Value, + } + + #[allow(unused_mut)] + let mut invoke_message: Option> = None; + + #[cfg(feature = "isolation")] + { + #[derive(serde::Deserialize)] + struct IsolationMessage<'a> { + cmd: String, + callback: CallbackFn, + error: CallbackFn, + #[serde(flatten)] + payload: RawIsolationPayload<'a>, + } + + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + invoke_message.replace( + serde_json::from_str::>(&message) + .map_err(Into::into) + .and_then(|message| { + Ok(Message { + cmd: message.cmd, + callback: message.callback, + error: message.error, + payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, + }) + }), + ); + } + } + + match invoke_message + .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) + { + Ok(message) => { + let _ = window.on_message(InvokeRequest { + cmd: message.cmd, + callback: message.callback, + error: message.error, + body: message.payload.into(), + }); + } + Err(e) => { + let _ = window.eval(&format!( + r#"console.error({})"#, + serde_json::Value::String(e.to_string()) + )); + } + } + } +} + +fn handle_ipc_request( + request: &HttpRequest, + manager: &WindowManager, + label: &str, +) -> std::result::Result { + if let Some(window) = manager.get_window(label) { + // TODO: consume instead + #[allow(unused_mut)] + let mut body = request.body().clone(); + + let cmd = request + .uri() + .strip_prefix("ipc://localhost/") + .map(|c| c.to_string()) + // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows + // where `$P` is not `localhost/*` + // in this case the IPC call is considered invalid + .unwrap_or_else(|| "".to_string()); + let cmd = percent_encoding::percent_decode(cmd.as_bytes()) + .decode_utf8_lossy() + .to_string(); + + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + #[cfg(all(feature = "isolation", ipc_custom_protocol))] + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + match crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) + .and_then(|raw| crypto_keys.decrypt(raw)) + { + Ok(data) => body = data, + Err(e) => { + return Err(e.to_string()); + } + } + } + + let callback = CallbackFn( + request + .headers() + .get("Tauri-Callback") + .ok_or("missing Tauri-Callback header")? + .to_str() + .map_err(|_| "Tauri-Callback header value must be a string")? + .parse() + .map_err(|_| "Tauri-Callback header value must be a numeric string")?, + ); + let error = CallbackFn( + request + .headers() + .get("Tauri-Error") + .ok_or("missing Tauri-Error header")? + .to_str() + .map_err(|_| "Tauri-Error header value must be a string")? + .parse() + .map_err(|_| "Tauri-Error header value must be a numeric string")?, + ); + + let content_type = request + .headers() + .get(reqwest::header::CONTENT_TYPE) + .and_then(|h| h.to_str().ok()) + .unwrap_or("application/octet-stream"); + let body = match content_type { + "application/octet-stream" => body.into(), + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + #[cfg(not(ipc_custom_protocol))] + "application/json" => serde_json::Value::Object(Default::default()).into(), + #[cfg(ipc_custom_protocol)] + "application/json" => serde_json::from_slice::(&body) + .map_err(|e| e.to_string())? + .into(), + _ => return Err(format!("unknown content type {content_type}")), + }; + + let payload = InvokeRequest { + cmd, + callback, + error, + body, + }; + + let rx = window.on_message(payload); + Ok(rx.recv().unwrap()) + } else { + Err("window not found".into()) + } +} diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 3399bb53e828..d839520bc696 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -10,18 +10,12 @@ use std::{ sync::{Arc, Mutex, MutexGuard}, }; -use http::{ - header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN}, - HeaderValue, Method, StatusCode, -}; use serde::Serialize; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; use url::Url; use tauri_macros::default_runtime; use tauri_utils::debug_eprintln; -#[cfg(feature = "isolation")] -use tauri_utils::pattern::isolation::RawIsolationPayload; use tauri_utils::{ assets::{AssetKey, CspHash}, config::{Csp, CspDirectiveSources}, @@ -34,7 +28,7 @@ use crate::{ PageLoadPayload, WindowMenuEvent, }, event::{assert_event_name_is_valid, Event, EventHandler, Listeners}, - ipc::{CallbackFn, Invoke, InvokeBody, InvokeHandler, InvokeResponder, InvokeResponse}, + ipc::{Invoke, InvokeHandler, InvokeResponder}, pattern::PatternJavascript, plugin::PluginStore, runtime::{ @@ -50,7 +44,7 @@ use crate::{ config::{AppUrl, Config, WindowUrl}, PackageInfo, }, - window::{InvokeRequest, UriSchemeProtocolHandler, WebResourceRequestHandler}, + window::{UriSchemeProtocolHandler, WebResourceRequestHandler}, Context, EventLoopMessage, Icon, Manager, Pattern, Runtime, Scopes, StateManager, Window, WindowEvent, }; @@ -522,7 +516,7 @@ impl WindowManager { if !registered_scheme_protocols.contains(&"ipc".into()) { pending.register_uri_scheme_protocol( "ipc", - self.prepare_ipc_scheme_protocol(pending.label.clone()), + crate::ipc::protocol::get(self.clone(), pending.label.clone()), ); registered_scheme_protocols.push("ipc".into()); } @@ -588,76 +582,6 @@ impl WindowManager { Ok(pending) } - #[cfg(not(ipc_custom_protocol))] - fn prepare_ipc_message_handler( - &self, - ) -> crate::runtime::webview::WebviewIpcHandler { - let manager = self.clone(); - Box::new(move |window, request| handle_ipc_message(request, &manager, &window.label)) - } - - fn prepare_ipc_scheme_protocol(&self, label: String) -> UriSchemeProtocolHandler { - let manager = self.clone(); - Box::new(move |request| { - let mut response = match *request.method() { - Method::POST => { - let (mut response, content_type) = match handle_ipc_request(request, &manager, &label) { - Ok(data) => match data { - InvokeResponse::Ok(InvokeBody::Json(v)) => ( - HttpResponse::new(serde_json::to_vec(&v)?.into()), - "application/json", - ), - InvokeResponse::Ok(InvokeBody::Raw(v)) => { - (HttpResponse::new(v.into()), "application/octet-stream") - } - InvokeResponse::Err(e) => { - let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") - } - }, - Err(e) => { - let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); - response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") - } - }; - - response.set_mimetype(Some(content_type.into())); - - response - } - - Method::OPTIONS => { - let mut r = HttpResponse::new(Vec::new().into()); - r.headers_mut().insert( - ACCESS_CONTROL_ALLOW_HEADERS, - HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error"), - ); - r - } - - _ => { - let mut r = HttpResponse::new( - "only POST and OPTIONS are allowed" - .as_bytes() - .to_vec() - .into(), - ); - r.set_status(StatusCode::METHOD_NOT_ALLOWED); - r.set_mimetype(Some("text/plain".into())); - r - } - }; - - response - .headers_mut() - .insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*")); - - Ok(response) - }) - } - pub fn get_asset(&self, mut path: String) -> Result> { let assets = &self.inner.assets; if path.ends_with('/') { @@ -1137,7 +1061,7 @@ impl WindowManager { )?; #[cfg(not(ipc_custom_protocol))] { - pending.ipc_handler = Some(self.prepare_ipc_message_handler()); + pending.ipc_handler = Some(crate::ipc::protocol::message_handler(self.clone())); } // in `Windows`, we need to force a data_directory @@ -1475,154 +1399,6 @@ fn request_to_path(request: &tauri_runtime::http::Request, base_url: &str) -> St } } -#[cfg(not(ipc_custom_protocol))] -fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { - if let Some(window) = manager.get_window(label) { - #[derive(serde::Deserialize)] - struct Message { - cmd: String, - callback: CallbackFn, - error: CallbackFn, - #[serde(flatten)] - payload: serde_json::Value, - } - - #[allow(unused_mut)] - let mut invoke_message: Option> = None; - - #[cfg(feature = "isolation")] - { - #[derive(serde::Deserialize)] - struct IsolationMessage<'a> { - cmd: String, - callback: CallbackFn, - error: CallbackFn, - #[serde(flatten)] - payload: RawIsolationPayload<'a>, - } - - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - invoke_message.replace( - serde_json::from_str::>(&message) - .map_err(Into::into) - .and_then(|message| { - Ok(Message { - cmd: message.cmd, - callback: message.callback, - error: message.error, - payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, - }) - }), - ); - } - } - - match invoke_message - .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) - { - Ok(message) => { - let _ = window.on_message(InvokeRequest { - cmd: message.cmd, - callback: message.callback, - error: message.error, - body: message.payload.into(), - }); - } - Err(e) => { - let _ = window.eval(&format!( - r#"console.error({})"#, - serde_json::Value::String(e.to_string()) - )); - } - } - } -} - -fn handle_ipc_request( - request: &HttpRequest, - manager: &WindowManager, - label: &str, -) -> std::result::Result { - if let Some(window) = manager.get_window(label) { - // TODO: consume instead - #[allow(unused_mut)] - let mut body = request.body().clone(); - - let cmd = request - .uri() - .strip_prefix("ipc://localhost/") - .map(|c| c.to_string()) - // the `strip_prefix` only returns None when a request is made to `https://tauri.$P` on Windows - // where `$P` is not `localhost/*` - // in this case the IPC call is considered invalid - .unwrap_or_else(|| "".to_string()); - let cmd = percent_encoding::percent_decode(cmd.as_bytes()) - .decode_utf8_lossy() - .to_string(); - - // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it - #[cfg(all(feature = "isolation", ipc_custom_protocol))] - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - match RawIsolationPayload::try_from(&body).and_then(|raw| crypto_keys.decrypt(raw)) { - Ok(data) => body = data, - Err(e) => { - return Err(e.to_string()); - } - } - } - - let callback = CallbackFn( - request - .headers() - .get("Tauri-Callback") - .ok_or("missing Tauri-Callback header")? - .to_str() - .map_err(|_| "Tauri-Callback header value must be a string")? - .parse() - .map_err(|_| "Tauri-Callback header value must be a numeric string")?, - ); - let error = CallbackFn( - request - .headers() - .get("Tauri-Error") - .ok_or("missing Tauri-Error header")? - .to_str() - .map_err(|_| "Tauri-Error header value must be a string")? - .parse() - .map_err(|_| "Tauri-Error header value must be a numeric string")?, - ); - - let content_type = request - .headers() - .get(reqwest::header::CONTENT_TYPE) - .and_then(|h| h.to_str().ok()) - .unwrap_or("application/octet-stream"); - let body = match content_type { - "application/octet-stream" => body.into(), - // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it - #[cfg(not(ipc_custom_protocol))] - "application/json" => serde_json::Value::Object(Default::default()).into(), - #[cfg(ipc_custom_protocol)] - "application/json" => serde_json::from_slice::(&body) - .map_err(|e| e.to_string())? - .into(), - _ => return Err(format!("unknown content type {content_type}")), - }; - - let payload = InvokeRequest { - cmd, - callback, - error, - body, - }; - - let rx = window.on_message(payload); - Ok(rx.recv().unwrap()) - } else { - Err("window not found".into()) - } -} - #[cfg(test)] mod tests { use super::replace_with_callback; From 589353f331f0ddbf1a0b4b54f24cbbbde0a7af58 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 18:35:09 -0300 Subject: [PATCH 29/90] fix isolation build --- core/tauri/src/ipc/protocol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index d11534a720ab..524f064d0895 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -167,7 +167,7 @@ fn handle_ipc_request( // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it #[cfg(all(feature = "isolation", ipc_custom_protocol))] - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { match crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) .and_then(|raw| crypto_keys.decrypt(raw)) { From f01d3e7bd14dc6db6c603c19b0e32f965607fef8 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 18:42:24 -0300 Subject: [PATCH 30/90] add header --- core/tauri/src/ipc/protocol.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 524f064d0895..d00b897c449d 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + use http::{ header::{ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_ORIGIN}, HeaderValue, Method, StatusCode, From 1e5e18e41102fce7f54f1091f20c97f9719e210a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 18:42:54 -0300 Subject: [PATCH 31/90] fix mobile build --- core/tauri/src/manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index d839520bc696..77f263d3d3fc 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -732,7 +732,7 @@ impl WindowManager { Ok(r) => { let mut response_cache_ = response_cache.lock().unwrap(); let mut response = None; - if r.status() == StatusCode::NOT_MODIFIED { + if r.status() == http::StatusCode::NOT_MODIFIED { response = response_cache_.get(&url); } let response = if let Some(r) = response { From 4f086dca3ae5b5ce1bc1a235b5c7482a8c3e068c Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 12 Jun 2023 18:48:29 -0300 Subject: [PATCH 32/90] fix linux ipc message handler build --- core/tauri/src/ipc/protocol.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index d00b897c449d..89b44f2e6b15 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -107,10 +107,10 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l callback: CallbackFn, error: CallbackFn, #[serde(flatten)] - payload: RawIsolationPayload<'a>, + payload: crate::utils::pattern::isolation::RawIsolationPayload<'a>, } - if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { invoke_message.replace( serde_json::from_str::>(&message) .map_err(Into::into) From 157debd1e3cc60c7db24060d71a8e7e4cbb6613b Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 13 Jun 2023 08:23:08 -0300 Subject: [PATCH 33/90] use postMessage IPC on Android we can't read the custom protocol request body on Android :( --- core/tauri-runtime-wry/Cargo.toml | 2 +- core/tauri/build.rs | 2 +- core/tauri/src/app.rs | 2 +- core/tauri/src/window.rs | 2 +- examples/api/src-tauri/Cargo.lock | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index f1cbba60022c..82401c7298f4 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { git = "https://github.com/tauri-apps/wry", branch = "linux-body", default-features = false, features = [ "file-drop", "protocol" ] } +wry = { git = "https://github.com/tauri-apps/wry", branch = "dev", default-features = false, features = [ "file-drop", "protocol" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 559408dcf5b6..669de4270fdf 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -52,7 +52,7 @@ fn main() { alias( "ipc_custom_protocol", - target_os != "linux" || has_feature("linux-ipc-protocol"), + target_os != "android" && (target_os != "linux" || has_feature("linux-ipc-protocol")), ); let checked_features_out_path = Path::new(&var("OUT_DIR").unwrap()).join("checked_features"); diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 75e07b2517b4..f2de9abcf300 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -857,7 +857,7 @@ impl Builder { use_post_message_condition: "false", #[cfg(not(ipc_custom_protocol))] use_post_message_condition: &format!( - "navigator.appVersion.includes('Linux') && !cmd.startsWith('{}')", + "(navigator.appVersion.includes('Linux') || navigator.appVersion.includes('Android')) && !cmd.startsWith('{}')", crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX ), } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 9e2f1ab57031..8d85122f3528 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1760,7 +1760,7 @@ impl Window { (responder)(window, cmd, &response, callback, error); } - tx.send(response).unwrap(); + let _ = tx.send(response); }, ), request.cmd.clone(), diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 13dd2c13d691..8b33b293c97d 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wry" version = "0.28.3" -source = "git+https://github.com/tauri-apps/wry?branch=linux-body#1ca7a808d188e7f9b9b11c9ae55fa81cb7c95fdc" +source = "git+https://github.com/tauri-apps/wry?branch=dev#d2c1819f81a7b03288348f1c3b195407400dfbde" dependencies = [ "base64", "block", From f923c2957a2da4e8ef5b40e91ce56881138adaa3 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 13 Jun 2023 09:15:27 -0300 Subject: [PATCH 34/90] simplify proces-ipc-message-fn --- core/tauri/scripts/process-ipc-message-fn.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js index 66191fa65dac..6e421e6924b8 100644 --- a/core/tauri/scripts/process-ipc-message-fn.js +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -3,11 +3,7 @@ // SPDX-License-Identifier: MIT (function (message) { - // on Android we must send the body as a string - if ( - !navigator.appVersion.includes("Android") && - (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) - ) { + if (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) { return { contentType: 'application/octet-stream', data: message From 909f4ca6b682f5f56d7b07447db3fc97759f2650 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 13 Jun 2023 09:24:44 -0300 Subject: [PATCH 35/90] remove test code [skip ci] --- core/tauri/scripts/ipc-protocol.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index c6093aba9b14..4f9b6597f127 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -13,7 +13,6 @@ window.ipc.postMessage(data) } else { const { contentType, data } = processIpcMessage(payload) - let i = new Date() fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { method: 'POST', body: data, @@ -23,7 +22,6 @@ 'Tauri-Error': error, } }).then((response) => { - i = new Date() const cb = response.ok ? callback : error // we need to split here because on Android the content-type gets duplicated switch ((response.headers.get('content-type') || '').split(',')[0]) { From 14c78c5997a5004dc4f1bada2297d376813c2496 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 13 Jun 2023 12:40:37 -0300 Subject: [PATCH 36/90] wry 0.29 [skip ci] --- core/tauri-runtime-wry/Cargo.toml | 2 +- examples/api/src-tauri/Cargo.lock | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index 82401c7298f4..4df45e404534 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -15,7 +15,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wry = { git = "https://github.com/tauri-apps/wry", branch = "dev", default-features = false, features = [ "file-drop", "protocol" ] } +wry = { version = "0.29", default-features = false, features = [ "file-drop", "protocol" ] } tauri-runtime = { version = "0.13.0-alpha.5", path = "../tauri-runtime" } tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 8b33b293c97d..17e20fa3d3d5 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3965,8 +3965,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.28.3" -source = "git+https://github.com/tauri-apps/wry?branch=dev#d2c1819f81a7b03288348f1c3b195407400dfbde" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a673852d6cefb9d1e63b7bf6f57ba728dd76ed5c06229f90b0e528fc9dffacc0" dependencies = [ "base64", "block", From 928d8efae975fecfa999539f369176e8f7025275 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 13 Jun 2023 13:22:15 -0300 Subject: [PATCH 37/90] enhance ipc-protocol.js platform detection --- core/tauri/scripts/ipc-protocol.js | 4 +++- core/tauri/src/app.rs | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 4f9b6597f127..180a2b6a6bf8 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -4,11 +4,13 @@ (function () { const processIpcMessage = __RAW_process_ipc_message_fn__ + const osName = __TEMPLATE_os_name__ + const fetchChannelDataCommandPrefix = __TEMPLATE_fetch_channel_data_command_prefix__ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload } = message - if (__RAW_use_post_message_condition__) { + if ((osName === 'linux' || osName === 'android') && !cmd.startsWith(fetchChannelDataCommandPrefix)) { const { data } = processIpcMessage({ cmd, callback, error, ...payload }) window.ipc.postMessage(data) } else { diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index f2de9abcf300..31d161ab88a1 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -838,8 +838,8 @@ struct InvokeInitializationScript<'a> { /// The function that processes the IPC message. #[raw] process_ipc_message_fn: &'a str, - #[raw] - use_post_message_condition: &'a str, + os_name: &'a str, + fetch_channel_data_command_prefix: &'a str, } impl Builder { @@ -853,13 +853,8 @@ impl Builder { invoke_responder: None, invoke_initialization_script: InvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, - #[cfg(ipc_custom_protocol)] - use_post_message_condition: "false", - #[cfg(not(ipc_custom_protocol))] - use_post_message_condition: &format!( - "(navigator.appVersion.includes('Linux') || navigator.appVersion.includes('Android')) && !cmd.startsWith('{}')", - crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX - ), + os_name: std::env::consts::OS, + fetch_channel_data_command_prefix: crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX, } .render_default(&Default::default()) .unwrap() From 3d32784e62ac73af6eed4dc0bf595d04af611a2b Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 16 Jun 2023 12:58:40 -0300 Subject: [PATCH 38/90] fix isolation message detection --- core/tauri-utils/src/pattern/isolation.js | 1 - 1 file changed, 1 deletion(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index acb638feeeaf..18e4cad86278 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -81,7 +81,6 @@ function isIsolationPayload(data) { return ( typeof data === 'object' && - typeof data.payload === 'object' && 'callback' in data && 'error' in data && !isIsolationMessage(data) From 53f24b5d479642dd0051056f94e543f2cd5602ec Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 19 Jun 2023 09:12:09 -0300 Subject: [PATCH 39/90] update CSP --- .../test/fixture/src-tauri/tauri.conf.json | 2 +- examples/api/src-tauri/Cargo.lock | 18 +++++++++--------- examples/api/src-tauri/tauri.conf.json | 2 +- examples/helloworld/tauri.conf.json | 2 +- examples/isolation/tauri.conf.json | 2 +- examples/multiwindow/tauri.conf.json | 2 +- examples/navigation/tauri.conf.json | 2 +- examples/parent-window/tauri.conf.json | 2 +- examples/resources/src-tauri/tauri.conf.json | 2 +- examples/splashscreen/tauri.conf.json | 2 +- examples/state/tauri.conf.json | 2 +- examples/streaming/tauri.conf.json | 2 +- .../src-tauri/tauri.conf.json | 2 +- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 2 +- .../cpu_intensive/src-tauri/tauri.conf.json | 2 +- .../files_transfer/src-tauri/tauri.conf.json | 2 +- .../tests/helloworld/src-tauri/tauri.conf.json | 2 +- .../vanilla/src-tauri/tauri.conf.json | 2 +- 19 files changed, 27 insertions(+), 27 deletions(-) diff --git a/core/tauri/test/fixture/src-tauri/tauri.conf.json b/core/tauri/test/fixture/src-tauri/tauri.conf.json index 147743e3c13c..16b11b249e1f 100644 --- a/core/tauri/test/fixture/src-tauri/tauri.conf.json +++ b/core/tauri/test/fixture/src-tauri/tauri.conf.json @@ -15,7 +15,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" } } } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 12cba2595409..25bb5e0ac034 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -2807,9 +2807,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "state" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" +checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" dependencies = [ "loom", ] @@ -2966,7 +2966,7 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" [[package]] name = "tauri" -version = "2.0.0-alpha.9" +version = "2.0.0-alpha.10" dependencies = [ "anyhow", "bytes", @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" dependencies = [ "anyhow", "cargo_toml", @@ -3034,7 +3034,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" dependencies = [ "base64", "brotli", @@ -3058,7 +3058,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" dependencies = [ "heck", "proc-macro2", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.13.0-alpha.5" +version = "0.13.0-alpha.6" dependencies = [ "gtk", "http", @@ -3133,7 +3133,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.13.0-alpha.5" +version = "0.13.0-alpha.6" dependencies = [ "cocoa", "gtk", @@ -3152,7 +3152,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" dependencies = [ "aes-gcm", "brotli", diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index fc7eef0ed0fb..e19ed4a01ade 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -87,7 +87,7 @@ "windows": [], "security": { "csp": { - "default-src": "'self' customprotocol: asset:", + "default-src": "'self' customprotocol: asset: ipc:", "font-src": ["https://fonts.gstatic.com"], "img-src": "'self' asset: https://asset.localhost blob: data:", "style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com" diff --git a/examples/helloworld/tauri.conf.json b/examples/helloworld/tauri.conf.json index 90bd1e98a2fd..318a977e6ec2 100644 --- a/examples/helloworld/tauri.conf.json +++ b/examples/helloworld/tauri.conf.json @@ -46,7 +46,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/isolation/tauri.conf.json b/examples/isolation/tauri.conf.json index a93f342bfa1f..515853772cec 100644 --- a/examples/isolation/tauri.conf.json +++ b/examples/isolation/tauri.conf.json @@ -60,7 +60,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" } } } diff --git a/examples/multiwindow/tauri.conf.json b/examples/multiwindow/tauri.conf.json index 3c0b34ad98b5..4a9dac5ac381 100644 --- a/examples/multiwindow/tauri.conf.json +++ b/examples/multiwindow/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/navigation/tauri.conf.json b/examples/navigation/tauri.conf.json index 97378e737391..f50ebbb40158 100644 --- a/examples/navigation/tauri.conf.json +++ b/examples/navigation/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/parent-window/tauri.conf.json b/examples/parent-window/tauri.conf.json index 385eaae47181..0eeb01c7e14d 100644 --- a/examples/parent-window/tauri.conf.json +++ b/examples/parent-window/tauri.conf.json @@ -27,7 +27,7 @@ "category": "DeveloperTool" }, "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/resources/src-tauri/tauri.conf.json b/examples/resources/src-tauri/tauri.conf.json index 7a94d46ab22a..e105a44a8a1e 100644 --- a/examples/resources/src-tauri/tauri.conf.json +++ b/examples/resources/src-tauri/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/splashscreen/tauri.conf.json b/examples/splashscreen/tauri.conf.json index d4e128ee7a69..91f00c6c23ae 100644 --- a/examples/splashscreen/tauri.conf.json +++ b/examples/splashscreen/tauri.conf.json @@ -44,7 +44,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/state/tauri.conf.json b/examples/state/tauri.conf.json index 4614753a1e96..52e2ea60a27d 100644 --- a/examples/state/tauri.conf.json +++ b/examples/state/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'" + "csp": "default-src 'self' ipc:" } } } diff --git a/examples/streaming/tauri.conf.json b/examples/streaming/tauri.conf.json index 0dfdb7ab3603..970f5760ebd5 100644 --- a/examples/streaming/tauri.conf.json +++ b/examples/streaming/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'; media-src stream: https://stream.localhost asset: https://asset.localhost", + "csp": "default-src 'self' ipc:; media-src stream: https://stream.localhost asset: https://asset.localhost", "assetProtocol": { "scope": ["**/test_video.mp4"] } diff --git a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json index 2d54d1dcee1a..147d8e85a02a 100644 --- a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json +++ b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json @@ -46,7 +46,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" } } } diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index b9efae49276d..db4183b79676 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L186"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L186"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L150"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L150"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L119"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L119"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L68"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L68"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L85"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L102"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L102"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L531"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L531"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L141"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L141"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L664"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L664"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L163"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L163"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L185"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L185"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L207"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L207"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L571"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L571"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L229"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L229"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L630"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L630"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L251"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L251"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L273"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L273"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L295"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L295"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L646"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L646"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L317"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L317"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L339"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L339"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L678"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L678"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L615"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L615"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L361"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L361"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L600"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L600"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L383"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L383"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L405"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L405"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L585"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L585"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L442"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L442"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L422"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L422"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L465"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L465"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L560"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L547"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L547"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L487"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L487"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L509"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L509"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L82"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L125"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/4a5b166ce/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":186,"character":16}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":186,"character":0}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":150,"character":16}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"tauri\") {\n if (\n args?.__tauriModule === \"Window\" &&\n args?.message?.cmd === \"manage\" &&\n args?.message?.data?.cmd?.type === \"close\"\n ) {\n console.log('closing window!');\n }\n }\n});\n\nconst { getCurrent } = await import(\"@tauri-apps/api/window\");\n\nconst win = getCurrent();\nawait win.close(); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":150,"character":0}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6},{"fileName":"tauri.ts","line":73,"character":6}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 85e895005e04..07558b2dc86f 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -161,7 +161,7 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { /** * Convert a device file path to an URL that can be loaded by the webview. * Note that `asset:` and `https://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources. + * Example CSP value: `"csp": "default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources. * * Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol) * in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object. diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json index aa6e927d594e..fe587f86c7bf 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" } } } diff --git a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json index aa6e927d594e..fe587f86c7bf 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" } } } diff --git a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json index aa6e927d594e..fe587f86c7bf 100644 --- a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" } } } diff --git a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json index 36149bb456af..a865173bd79f 100644 --- a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json +++ b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" } } } From 3bc3cd8a455ccd481fd6f51025976f569828fc1c Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 19 Jun 2023 09:49:28 -0300 Subject: [PATCH 40/90] speed up benchmark --- tooling/bench/tests/files_transfer/src-tauri/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tooling/bench/tests/files_transfer/src-tauri/src/main.rs b/tooling/bench/tests/files_transfer/src-tauri/src/main.rs index da93689e499e..34c294c26a3f 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/src/main.rs +++ b/tooling/bench/tests/files_transfer/src-tauri/src/main.rs @@ -5,7 +5,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use std::fs::read; -use tauri::{command, path::BaseDirectory, AppHandle, Manager, Runtime}; +use tauri::{command, ipc::Response, path::BaseDirectory, AppHandle, Manager, Runtime}; #[command] fn app_should_close(exit_code: i32) { @@ -13,13 +13,13 @@ fn app_should_close(exit_code: i32) { } #[command] -async fn read_file(app: AppHandle) -> Result, String> { +async fn read_file(app: AppHandle) -> Result { let path = app .path() .resolve(".tauri_3mb.json", BaseDirectory::Home) .map_err(|e| e.to_string())?; let contents = read(&path).map_err(|e| e.to_string())?; - Ok(contents) + Ok(Response::new(contents)) } fn main() { From 64d200762f8ed95e98920dd74b878cc96ae35d7a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 21 Jun 2023 22:17:51 -0300 Subject: [PATCH 41/90] impl channel on android [skip ci] --- .../src/main/java/app/tauri/plugin/Invoke.kt | 3 +- .../java/app/tauri/plugin/PluginManager.kt | 3 ++ core/tauri/src/ipc/mod.rs | 23 ++++++++++-- core/tauri/src/lib.rs | 14 +++++++- core/tauri/src/plugin/mobile.rs | 35 ++++++++++++++++++- 5 files changed, 73 insertions(+), 5 deletions(-) diff --git a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/Invoke.kt b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/Invoke.kt index 4bfb5bd908e0..3f0ea12146c3 100644 --- a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/Invoke.kt +++ b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/Invoke.kt @@ -14,6 +14,7 @@ class Invoke( val callback: Long, val error: Long, private val sendResponse: (callback: Long, data: PluginResult?) -> Unit, + private val sendChannelData: (channelId: Long, data: PluginResult) -> Unit, val data: JSObject) { fun resolve(data: JSObject?) { @@ -205,6 +206,6 @@ class Invoke( fun getChannel(name: String): Channel? { val channelDef = getString(name, "") val callback = channelDef.substring(CHANNEL_PREFIX.length).toLongOrNull() ?: return null - return Channel(callback) { res -> sendResponse(callback, PluginResult(res)) } + return Channel(callback) { res -> sendChannelData(callback, PluginResult(res)) } } } diff --git a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt index efb86ddd97b0..62ddc8d19d5a 100644 --- a/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt +++ b/core/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginManager.kt @@ -98,6 +98,8 @@ class PluginManager(val activity: AppCompatActivity) { error = result } handlePluginResponse(id, success?.toString(), error?.toString()) + }, { channelId, payload -> + sendChannelData(channelId, payload.toString()) }, data) dispatchPluginMessage(invoke, pluginId) @@ -131,4 +133,5 @@ class PluginManager(val activity: AppCompatActivity) { } private external fun handlePluginResponse(id: Int, success: String?, error: String?) + private external fun sendChannelData(id: Long, data: String) } diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 26d8f659a4c5..2631ebcb71f0 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -57,7 +57,7 @@ impl Clone for Channel { } } -impl Serialize for Channel { +impl Serialize for Channel { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -68,7 +68,26 @@ impl Serialize for Channel { impl Channel { pub(crate) fn new(window: Window, id: CallbackFn) -> Self { - Self { window, id } + #[allow(clippy::let_and_return)] + let channel = Self { window, id }; + + #[cfg(mobile)] + { + let channel_ = channel.clone(); + crate::plugin::mobile::on_channel_data( + channel.id, + Box::new(move |data| { + let _ = channel_.send(data); + }), + ); + } + + channel + } + + /// The channel identifier. + pub fn id(&self) -> CallbackFn { + self.id } /// Sends the given data through the channel. diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 6bc483514ecc..32df26a34c36 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -114,6 +114,13 @@ macro_rules! android_binding { handlePluginResponse, [i32, JString, JString], ); + ::tauri::wry::application::android_fn!( + app_tauri, + plugin, + PluginManager, + sendChannelData, + [i64, JString], + ); #[allow(non_snake_case)] pub unsafe fn handlePluginResponse( @@ -125,12 +132,17 @@ macro_rules! android_binding { ) { ::tauri::handle_android_plugin_response(env, id, success, error); } + + #[allow(non_snake_case)] + pub unsafe fn sendChannelData(env: JNIEnv, _: JClass, id: i64, data: JString) { + ::tauri::send_channel_data(env, id, data); + } }; } #[cfg(all(feature = "wry", target_os = "android"))] #[doc(hidden)] -pub use plugin::mobile::handle_android_plugin_response; +pub use plugin::mobile::{handle_android_plugin_response, send_channel_data}; #[cfg(all(feature = "wry", target_os = "android"))] #[doc(hidden)] pub use tauri_runtime_wry::wry; diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index ad5b71a33586..82b7f8681d2d 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -4,7 +4,10 @@ use super::{PluginApi, PluginHandle}; -use crate::{ipc::InvokeBody, AppHandle, Runtime}; +use crate::{ + ipc::{CallbackFn, InvokeBody}, + AppHandle, Runtime, +}; #[cfg(target_os = "android")] use crate::{ runtime::RuntimeHandle, @@ -23,9 +26,11 @@ use std::{ type PluginResponse = Result; type PendingPluginCallHandler = Box; +type ChannelDataHandler = Box; static PENDING_PLUGIN_CALLS: OnceCell>> = OnceCell::new(); +static CHANNELS: OnceCell>> = OnceCell::new(); /// Possible errors when invoking a plugin. #[derive(Debug, thiserror::Error)] @@ -48,6 +53,14 @@ pub enum PluginInvokeError { CannotSerializePayload(serde_json::Error), } +pub(crate) fn on_channel_data(id: CallbackFn, handler: ChannelDataHandler) { + CHANNELS + .get_or_init(Default::default) + .lock() + .unwrap() + .insert(id.0, handler); +} + /// Glue between Rust and the Kotlin code that sends the plugin response back. #[cfg(target_os = "android")] pub fn handle_android_plugin_response( @@ -90,6 +103,26 @@ pub fn handle_android_plugin_response( } } +/// Glue between Rust and the Kotlin code that sends the channel data. +#[cfg(target_os = "android")] +pub fn send_channel_data( + env: jni::JNIEnv<'_>, + channel_id: i64, + data_str: jni::objects::JString<'_>, +) { + let data: serde_json::Value = + serde_json::from_str(env.get_string(data_str).unwrap().to_str().unwrap()).unwrap(); + + if let Some(handler) = CHANNELS + .get_or_init(Default::default) + .lock() + .unwrap() + .get(&(channel_id as usize)) + { + handler(data); + } +} + /// Error response from the Kotlin and Swift backends. #[derive(Debug, thiserror::Error, Clone, serde::Deserialize)] pub struct ErrorResponse { From 19addfc141a56eb216648d58bcf62f96161e7213 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 21 Jun 2023 22:18:18 -0300 Subject: [PATCH 42/90] fix mobile response [skip ci] --- core/tauri/src/window.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 2f4c897f696f..245f72e96ab0 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1703,8 +1703,6 @@ impl Window { }; let (tx, rx) = sync_channel(1); - #[cfg(mobile)] - let tx_ = tx.clone(); let custom_responder = self.manager.invoke_responder(); @@ -1851,13 +1849,15 @@ impl Window { { if !handled { handled = true; + let resolver_ = resolver.clone(); if let Err(e) = crate::plugin::mobile::run_command( plugin, &app_handle, message.command, message.payload, - move |response| { - tx_.send(response.into()).unwrap(); + move |response| match response { + Ok(r) => resolver_.resolve(r), + Err(e) => resolver_.reject(e), }, ) { resolver.reject(e.to_string()); From b7a465509710600048fd326f2bfa02c7950a93a3 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 22 Jun 2023 09:52:04 -0300 Subject: [PATCH 43/90] impl iOS --- .../ios-api/Sources/Tauri/Channel.swift | 4 +- .../mobile/ios-api/Sources/Tauri/Invoke.swift | 110 +++++----- .../mobile/ios-api/Sources/Tauri/Tauri.swift | 198 ++++++++++-------- core/tauri/src/ios.rs | 16 +- core/tauri/src/plugin/mobile.rs | 26 ++- 5 files changed, 206 insertions(+), 148 deletions(-) diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Channel.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Channel.swift index 6722caec0f24..f3d03ba662b7 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Channel.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Channel.swift @@ -6,8 +6,8 @@ public class Channel { public let id: UInt64 let handler: (JsonValue) -> Void - public init(callback: UInt64, handler: @escaping (JsonValue) -> Void) { - self.id = callback + public init(id: UInt64, handler: @escaping (JsonValue) -> Void) { + self.id = id self.handler = handler } diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift index 15ffb7ac2ff4..b11d31f598dd 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift @@ -8,76 +8,88 @@ import UIKit let CHANNEL_PREFIX = "__CHANNEL__:" @objc public class Invoke: NSObject, JSValueContainer, BridgedJSValueContainer { - public var dictionaryRepresentation: NSDictionary { - return data as NSDictionary - } + public var dictionaryRepresentation: NSDictionary { + return data as NSDictionary + } - public static var jsDateFormatter: ISO8601DateFormatter = { - return ISO8601DateFormatter() - }() + public static var jsDateFormatter: ISO8601DateFormatter = { + return ISO8601DateFormatter() + }() public var command: String var callback: UInt64 var error: UInt64 - public var data: JSObject - var sendResponse: (UInt64, JsonValue?) -> Void + public var data: JSObject + var sendResponse: (UInt64, JsonValue?) -> Void + var sendChannelData: (UInt64, JsonValue) -> Void - public init(command: String, callback: UInt64, error: UInt64, sendResponse: @escaping (UInt64, JsonValue?) -> Void, data: JSObject?) { + public init( + command: String, callback: UInt64, error: UInt64, + sendResponse: @escaping (UInt64, JsonValue?) -> Void, + sendChannelData: @escaping (UInt64, JsonValue) -> Void, data: JSObject? + ) { self.command = command self.callback = callback self.error = error - self.data = data ?? [:] - self.sendResponse = sendResponse - } + self.data = data ?? [:] + self.sendResponse = sendResponse + self.sendChannelData = sendChannelData + } - public func resolve() { - sendResponse(callback, nil) - } + public func resolve() { + sendResponse(callback, nil) + } - public func resolve(_ data: JsonObject) { - resolve(.dictionary(data)) - } + public func resolve(_ data: JsonObject) { + resolve(.dictionary(data)) + } - public func resolve(_ data: JsonValue) { - sendResponse(callback, data) - } + public func resolve(_ data: JsonValue) { + sendResponse(callback, data) + } - public func reject(_ message: String, _ code: String? = nil, _ error: Error? = nil, _ data: JsonValue? = nil) { - let payload: NSMutableDictionary = ["message": message, "code": code ?? "", "error": error ?? ""] - if let data = data { - switch data { - case .dictionary(let dict): - for entry in dict { - payload[entry.key] = entry.value - } - } - } - sendResponse(self.error, .dictionary(payload as! JsonObject)) - } + public func reject( + _ message: String, _ code: String? = nil, _ error: Error? = nil, _ data: JsonValue? = nil + ) { + let payload: NSMutableDictionary = [ + "message": message, "code": code ?? "", "error": error ?? "", + ] + if let data = data { + switch data { + case .dictionary(let dict): + for entry in dict { + payload[entry.key] = entry.value + } + } + } + sendResponse(self.error, .dictionary(payload as! JsonObject)) + } - public func unimplemented() { - unimplemented("not implemented") - } + public func unimplemented() { + unimplemented("not implemented") + } - public func unimplemented(_ message: String) { - sendResponse(error, .dictionary(["message": message])) - } + public func unimplemented(_ message: String) { + sendResponse(error, .dictionary(["message": message])) + } - public func unavailable() { - unavailable("not available") - } + public func unavailable() { + unavailable("not available") + } - public func unavailable(_ message: String) { - sendResponse(error, .dictionary(["message": message])) - } + public func unavailable(_ message: String) { + sendResponse(error, .dictionary(["message": message])) + } public func getChannel(_ key: String) -> Channel? { let channelDef = getString(key, "") - guard let callback = UInt64(channelDef.components(separatedBy: CHANNEL_PREFIX)[1]) else { + guard let channelId = UInt64(channelDef.components(separatedBy: CHANNEL_PREFIX)[1]) else { return nil } - return Channel(callback: callback, handler: { (res: JsonValue) -> Void in - self.sendResponse(callback, res) - }) + return Channel( + id: channelId, + handler: { (res: JsonValue) -> Void in + self.sendChannelData(channelId, res) + }) } } diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift index 51808dccac45..80a80fab764d 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift @@ -2,131 +2,147 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -import SwiftRs import Foundation +import SwiftRs import UIKit import WebKit import os.log class PluginHandle { - var instance: Plugin - var loaded = false + var instance: Plugin + var loaded = false - init(plugin: Plugin) { - instance = plugin - } + init(plugin: Plugin) { + instance = plugin + } } public class PluginManager { - static let shared: PluginManager = PluginManager() - public var viewController: UIViewController? - var plugins: [String: PluginHandle] = [:] - var ipcDispatchQueue = DispatchQueue(label: "ipc") - public var isSimEnvironment: Bool { - #if targetEnvironment(simulator) - return true - #else - return false - #endif - } + static let shared: PluginManager = PluginManager() + public var viewController: UIViewController? + var plugins: [String: PluginHandle] = [:] + var ipcDispatchQueue = DispatchQueue(label: "ipc") + public var isSimEnvironment: Bool { + #if targetEnvironment(simulator) + return true + #else + return false + #endif + } - public func assetUrl(fromLocalURL url: URL?) -> URL? { - guard let inputURL = url else { - return nil - } + public func assetUrl(fromLocalURL url: URL?) -> URL? { + guard let inputURL = url else { + return nil + } - return URL(string: "asset://localhost")!.appendingPathComponent(inputURL.path) - } + return URL(string: "asset://localhost")!.appendingPathComponent(inputURL.path) + } - func onWebviewCreated(_ webview: WKWebView) { - for (_, handle) in plugins { - if (!handle.loaded) { - handle.instance.load(webview: webview) - } - } - } + func onWebviewCreated(_ webview: WKWebView) { + for (_, handle) in plugins { + if !handle.loaded { + handle.instance.load(webview: webview) + } + } + } - func load(name: String, plugin: P, config: JSObject, webview: WKWebView?) { + func load(name: String, plugin: P, config: JSObject, webview: WKWebView?) { plugin.setConfig(config) - let handle = PluginHandle(plugin: plugin) - if let webview = webview { - handle.instance.load(webview: webview) - handle.loaded = true - } - plugins[name] = handle - } + let handle = PluginHandle(plugin: plugin) + if let webview = webview { + handle.instance.load(webview: webview) + handle.loaded = true + } + plugins[name] = handle + } - func invoke(name: String, invoke: Invoke) { - if let plugin = plugins[name] { - ipcDispatchQueue.async { - let selectorWithThrows = Selector(("\(invoke.command):error:")) - if plugin.instance.responds(to: selectorWithThrows) { - var error: NSError? = nil - withUnsafeMutablePointer(to: &error) { - let methodIMP: IMP! = plugin.instance.method(for: selectorWithThrows) - unsafeBitCast(methodIMP, to: (@convention(c)(Any?, Selector, Invoke, OpaquePointer) -> Void).self)(plugin.instance, selectorWithThrows, invoke, OpaquePointer($0)) - } - if let error = error { - invoke.reject("\(error)") - // TODO: app crashes without this leak - let _ = Unmanaged.passRetained(error) - } - } else { - let selector = Selector(("\(invoke.command):")) - if plugin.instance.responds(to: selector) { - plugin.instance.perform(selector, with: invoke) - } else { - invoke.reject("No command \(invoke.command) found for plugin \(name)") - } - } - } - } else { - invoke.reject("Plugin \(name) not initialized") - } - } + func invoke(name: String, invoke: Invoke) { + if let plugin = plugins[name] { + ipcDispatchQueue.async { + let selectorWithThrows = Selector(("\(invoke.command):error:")) + if plugin.instance.responds(to: selectorWithThrows) { + var error: NSError? = nil + withUnsafeMutablePointer(to: &error) { + let methodIMP: IMP! = plugin.instance.method(for: selectorWithThrows) + unsafeBitCast( + methodIMP, to: (@convention(c) (Any?, Selector, Invoke, OpaquePointer) -> Void).self)( + plugin.instance, selectorWithThrows, invoke, OpaquePointer($0)) + } + if let error = error { + invoke.reject("\(error)") + // TODO: app crashes without this leak + let _ = Unmanaged.passRetained(error) + } + } else { + let selector = Selector(("\(invoke.command):")) + if plugin.instance.responds(to: selector) { + plugin.instance.perform(selector, with: invoke) + } else { + invoke.reject("No command \(invoke.command) found for plugin \(name)") + } + } + } + } else { + invoke.reject("Plugin \(name) not initialized") + } + } } extension PluginManager: NSCopying { - public func copy(with zone: NSZone? = nil) -> Any { - return self - } + public func copy(with zone: NSZone? = nil) -> Any { + return self + } } @_cdecl("register_plugin") func registerPlugin(name: SRString, plugin: NSObject, config: NSDictionary?, webview: WKWebView?) { - PluginManager.shared.load( - name: name.toString(), - plugin: plugin as! Plugin, + PluginManager.shared.load( + name: name.toString(), + plugin: plugin as! Plugin, config: JSTypes.coerceDictionaryToJSObject(config ?? [:], formattingDatesAsStrings: true)!, webview: webview - ) + ) } @_cdecl("on_webview_created") func onWebviewCreated(webview: WKWebView, viewController: UIViewController) { - PluginManager.shared.viewController = viewController - PluginManager.shared.onWebviewCreated(webview) + PluginManager.shared.viewController = viewController + PluginManager.shared.onWebviewCreated(webview) } @_cdecl("run_plugin_command") func runCommand( - id: Int, - name: SRString, - command: SRString, - data: NSDictionary, - callback: @escaping @convention(c) (Int, Bool, UnsafePointer?) -> Void + id: Int, + name: SRString, + command: SRString, + data: NSDictionary, + callback: @escaping @convention(c) (Int, Bool, UnsafePointer?) -> Void, + sendChannelData: @escaping @convention(c) (UInt64, UnsafePointer) -> Void ) { let callbackId: UInt64 = 0 let errorId: UInt64 = 1 - let invoke = Invoke(command: command.toString(), callback: callbackId, error: errorId, sendResponse: { (fn: UInt64, payload: JsonValue?) -> Void in - let success = fn == callbackId - var payloadJson: String = "" - do { - try payloadJson = payload == nil ? "null" : payload!.jsonRepresentation() ?? "`Failed to serialize payload`" - } catch { - payloadJson = "`\(error)`" - } - callback(id, success, payloadJson.cString(using: String.Encoding.utf8)) - }, data: JSTypes.coerceDictionaryToJSObject(data, formattingDatesAsStrings: true)) - PluginManager.shared.invoke(name: name.toString(), invoke: invoke) + let invoke = Invoke( + command: command.toString(), callback: callbackId, error: errorId, + sendResponse: { (fn: UInt64, payload: JsonValue?) -> Void in + let success = fn == callbackId + var payloadJson: String = "" + do { + try payloadJson = + payload == nil ? "null" : payload!.jsonRepresentation() ?? "`Failed to serialize payload`" + } catch { + payloadJson = "`\(error)`" + } + callback(id, success, payloadJson.cString(using: String.Encoding.utf8)) + }, + sendChannelData: { (id: UInt64, payload: JsonValue) -> Void in + var payloadJson: String = "" + do { + try payloadJson = + payload.jsonRepresentation() ?? "`Failed to serialize payload`" + } catch { + payloadJson = "`\(error)`" + } + sendChannelData(id, payloadJson) + }, data: JSTypes.coerceDictionaryToJSObject(data, formattingDatesAsStrings: true)) + PluginManager.shared.invoke(name: name.toString(), invoke: invoke) } diff --git a/core/tauri/src/ios.rs b/core/tauri/src/ios.rs index 18cfc45aa17d..16bb3c6e5cf7 100644 --- a/core/tauri/src/ios.rs +++ b/core/tauri/src/ios.rs @@ -9,7 +9,7 @@ use swift_rs::{swift, SRString, SwiftArg}; use std::{ ffi::c_void, - os::raw::{c_char, c_int}, + os::raw::{c_char, c_int, c_ulonglong}, }; type PluginMessageCallbackFn = unsafe extern "C" fn(c_int, c_int, *const c_char); @@ -23,12 +23,24 @@ impl<'a> SwiftArg<'a> for PluginMessageCallback { } } +type ChannelSendDataCallbackFn = unsafe extern "C" fn(c_ulonglong, *const c_char); +pub struct ChannelSendDataCallback(pub ChannelSendDataCallbackFn); + +impl<'a> SwiftArg<'a> for ChannelSendDataCallback { + type ArgType = ChannelSendDataCallbackFn; + + unsafe fn as_arg(&'a self) -> Self::ArgType { + self.0 + } +} + swift!(pub fn run_plugin_command( id: i32, name: &SRString, method: &SRString, data: *const c_void, - callback: PluginMessageCallback + callback: PluginMessageCallback, + send_channel_data_callback: ChannelSendDataCallback )); swift!(pub fn register_plugin( name: &SRString, diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 82b7f8681d2d..aed24c3c350f 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -30,7 +30,7 @@ type ChannelDataHandler = Box; static PENDING_PLUGIN_CALLS: OnceCell>> = OnceCell::new(); -static CHANNELS: OnceCell>> = OnceCell::new(); +static CHANNELS: OnceCell>> = OnceCell::new(); /// Possible errors when invoking a plugin. #[derive(Debug, thiserror::Error)] @@ -58,7 +58,7 @@ pub(crate) fn on_channel_data(id: CallbackFn, handler: ChannelDataHandler) { .get_or_init(Default::default) .lock() .unwrap() - .insert(id.0, handler); + .insert(id.0 as u64, handler); } /// Glue between Rust and the Kotlin code that sends the plugin response back. @@ -117,7 +117,7 @@ pub fn send_channel_data( .get_or_init(Default::default) .lock() .unwrap() - .get(&(channel_id as usize)) + .get(&(channel_id as u64)) { handler(data); } @@ -314,7 +314,7 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + ) -> Result<(), PluginInvokeError> { use std::{ ffi::CStr, - os::raw::{c_char, c_int}, + os::raw::{c_char, c_int, c_ulonglong}, }; let id: i32 = rand::random(); @@ -350,12 +350,30 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + } } + extern "C" fn send_channel_data_handler(id: c_ulonglong, payload: *const c_char) { + let payload = unsafe { + assert!(!payload.is_null()); + CStr::from_ptr(payload) + }; + + if let Some(handler) = CHANNELS + .get_or_init(Default::default) + .lock() + .unwrap() + .get(&id) + { + let payload = serde_json::from_str(payload.to_str().unwrap()).unwrap(); + handler(payload); + } + } + crate::ios::run_plugin_command( id, &name.into(), &command.as_ref().into(), crate::ios::json_to_dictionary(&payload.into_json()) as _, crate::ios::PluginMessageCallback(plugin_command_response_handler), + crate::ios::ChannelSendDataCallback(send_channel_data_handler), ); } From 99a2730299af58768d7744713d59951fe5ca5df9 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 22 Jun 2023 10:30:17 -0300 Subject: [PATCH 44/90] load channels on direct IPC messages to mobile plugins --- core/tauri/src/ipc/mod.rs | 51 +++++++++++++++++++-------------- core/tauri/src/plugin/mobile.rs | 16 ++++------- core/tauri/src/window.rs | 19 +++++++++++- 3 files changed, 52 insertions(+), 34 deletions(-) diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 2631ebcb71f0..1adca85e5ea3 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -35,7 +35,7 @@ pub type InvokeResponder = type OwnedInvokeResponder = dyn Fn(Window, String, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; -const CHANNEL_PREFIX: &str = "__CHANNEL__:"; +pub(crate) const CHANNEL_PREFIX: &str = "__CHANNEL__:"; pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "__tauriFetchChannelData__:"; #[derive(Default)] @@ -68,21 +68,33 @@ impl Serialize for Channel { impl Channel { pub(crate) fn new(window: Window, id: CallbackFn) -> Self { - #[allow(clippy::let_and_return)] - let channel = Self { window, id }; + Self { window, id } + } - #[cfg(mobile)] + pub(crate) fn load_from_ipc(window: Window, value: impl AsRef) -> Option { + if let Some(callback_id) = value + .as_ref() + .split_once(CHANNEL_PREFIX) + .and_then(|(_prefix, id)| id.parse().ok()) { - let channel_ = channel.clone(); - crate::plugin::mobile::on_channel_data( - channel.id, - Box::new(move |data| { - let _ = channel_.send(data); - }), - ); - } + #[allow(clippy::let_and_return)] + let channel = Channel::new(window, CallbackFn(callback_id)); + + #[cfg(mobile)] + { + let channel_ = channel.clone(); + crate::plugin::mobile::on_channel_data( + channel.id, + Box::new(move |data| { + let _ = channel_.send(data); + }), + ); + } - channel + Some(channel) + } else { + None + } } /// The channel identifier. @@ -118,16 +130,11 @@ impl<'de, R: Runtime> CommandArg<'de, R> for Channel { let window = command.message.window(); let value: String = Deserialize::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e))?; - if let Some(callback_id) = value - .split_once(CHANNEL_PREFIX) - .and_then(|(_prefix, id)| id.parse().ok()) - { - Ok(Channel::new(window, CallbackFn(callback_id))) - } else { - Err(InvokeError::from_anyhow(anyhow::anyhow!( + Channel::load_from_ipc(window, &value).ok_or_else(|| { + InvokeError::from_anyhow(anyhow::anyhow!( "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" - ))) - } + )) + }) } } diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index aed24c3c350f..82b8fc5285a0 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -4,10 +4,7 @@ use super::{PluginApi, PluginHandle}; -use crate::{ - ipc::{CallbackFn, InvokeBody}, - AppHandle, Runtime, -}; +use crate::{ipc::CallbackFn, AppHandle, Runtime}; #[cfg(target_os = "android")] use crate::{ runtime::RuntimeHandle, @@ -284,9 +281,7 @@ impl PluginHandle { self.name, &self.handle, command, - serde_json::to_value(payload) - .map_err(PluginInvokeError::CannotSerializePayload)? - .into(), + serde_json::to_value(payload).map_err(PluginInvokeError::CannotSerializePayload)?, move |response| { tx.send(response).unwrap(); }, @@ -309,7 +304,7 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + name: &str, _handle: &AppHandle, command: C, - payload: InvokeBody, + payload: serde_json::Value, handler: F, ) -> Result<(), PluginInvokeError> { use std::{ @@ -371,7 +366,7 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + id, &name.into(), &command.as_ref().into(), - crate::ios::json_to_dictionary(&payload.into_json()) as _, + crate::ios::json_to_dictionary(&payload) as _, crate::ios::PluginMessageCallback(plugin_command_response_handler), crate::ios::ChannelSendDataCallback(send_channel_data_handler), ); @@ -389,7 +384,7 @@ pub(crate) fn run_command< name: &str, handle: &AppHandle, command: C, - payload: InvokeBody, + payload: serde_json::Value, handler: F, ) -> Result<(), PluginInvokeError> { use jni::{errors::Error as JniError, objects::JObject, JNIEnv}; @@ -437,7 +432,6 @@ pub(crate) fn run_command< let id: i32 = rand::random(); let plugin_name = name.to_string(); let command = command.as_ref().to_string(); - let payload = payload.into_json(); let handle_ = handle.clone(); PENDING_PLUGIN_CALLS diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 245f72e96ab0..61f9a9085111 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1849,12 +1849,29 @@ impl Window { { if !handled { handled = true; + + fn load_channels(payload: &serde_json::Value, window: &Window) { + if let serde_json::Value::Object(map) = payload { + for v in map.values() { + if let serde_json::Value::String(s) = v { + if s.starts_with(crate::ipc::CHANNEL_PREFIX) { + crate::ipc::Channel::load_from_ipc(window.clone(), s); + } + } + } + } + } + + let payload = message.payload.into_json(); + // initialize channels + load_channels(&payload, &message.window); + let resolver_ = resolver.clone(); if let Err(e) = crate::plugin::mobile::run_command( plugin, &app_handle, message.command, - message.payload, + payload, move |response| match response { Ok(r) => resolver_.resolve(r), Err(e) => resolver_.reject(e), From 0dee01dd1e7702a96a121ca6806fe7898be4db55 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 22 Jun 2023 10:31:01 -0300 Subject: [PATCH 45/90] fix getChannel when it is not defined --- core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift index b11d31f598dd..f7490ae35bdc 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift @@ -83,7 +83,11 @@ let CHANNEL_PREFIX = "__CHANNEL__:" public func getChannel(_ key: String) -> Channel? { let channelDef = getString(key, "") - guard let channelId = UInt64(channelDef.components(separatedBy: CHANNEL_PREFIX)[1]) else { + let components = channelDef.components(separatedBy: CHANNEL_PREFIX) + if components.count < 2 { + return nil + } + guard let channelId = UInt64(components[1]) else { return nil } return Channel( From 3929578d232b14706aca8ea9526a9f81ccddca74 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 22 Jun 2023 17:55:13 -0300 Subject: [PATCH 46/90] refactor channel to support Rust message handler and simplify usage --- core/tauri/src/ipc/mod.rs | 110 +++++++++--------- core/tauri/src/plugin/mobile.rs | 23 ++-- core/tauri/src/window.rs | 5 +- examples/api/src-tauri/src/lib.rs | 6 +- .../java/com/plugin/sample/ExamplePlugin.kt | 5 + .../ios/Sources/ExamplePlugin.swift | 17 +-- .../tauri-plugin-sample/src/desktop.rs | 6 + .../tauri-plugin-sample/src/models.rs | 5 +- 8 files changed, 98 insertions(+), 79 deletions(-) diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 1adca85e5ea3..442b59c3d486 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -19,7 +19,7 @@ use tauri_macros::default_runtime; use crate::{ command::{CommandArg, CommandItem}, - Runtime, StateManager, Window, + Manager, Runtime, StateManager, Window, }; #[cfg(not(ipc_custom_protocol))] @@ -42,87 +42,85 @@ pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "__tauriFetchChannelD pub(crate) struct ChannelDataCache(pub(crate) Mutex>); /// An IPC channel. -#[default_runtime(crate::Wry, wry)] -pub struct Channel { - id: CallbackFn, - window: Window, -} - -impl Clone for Channel { - fn clone(&self) -> Self { - Self { - id: self.id, - window: self.window.clone(), - } - } +#[derive(Clone)] +pub struct Channel { + id: usize, + on_message: Arc crate::Result<()> + Send + Sync>, } -impl Serialize for Channel { +impl Serialize for Channel { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { - serializer.serialize_str(&format!("{CHANNEL_PREFIX}{}", self.id.0)) + serializer.serialize_str(&format!("{CHANNEL_PREFIX}{}", self.id)) } } -impl Channel { - pub(crate) fn new(window: Window, id: CallbackFn) -> Self { - Self { window, id } +impl Channel { + /// Creates a new channel with the given message handler. + pub fn new crate::Result<()> + Send + Sync + 'static>( + on_message: F, + ) -> Self { + Self::_new(rand::random(), on_message) + } + + pub(crate) fn _new crate::Result<()> + Send + Sync + 'static>( + id: usize, + on_message: F, + ) -> Self { + #[allow(clippy::let_and_return)] + let channel = Self { + id, + on_message: Arc::new(on_message), + }; + + #[cfg(mobile)] + crate::plugin::mobile::register_channel(channel.clone()); + + channel + } + + pub(crate) fn from_ipc(window: Window, callback: CallbackFn) -> Self { + Channel::_new(callback.0, move |body| { + let data_id = rand::random(); + window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + window.eval(&format!( + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", + callback.0 + )) + }) } - pub(crate) fn load_from_ipc(window: Window, value: impl AsRef) -> Option { - if let Some(callback_id) = value + pub(crate) fn load_from_ipc( + window: Window, + value: impl AsRef, + ) -> Option { + value .as_ref() .split_once(CHANNEL_PREFIX) .and_then(|(_prefix, id)| id.parse().ok()) - { - #[allow(clippy::let_and_return)] - let channel = Channel::new(window, CallbackFn(callback_id)); - - #[cfg(mobile)] - { - let channel_ = channel.clone(); - crate::plugin::mobile::on_channel_data( - channel.id, - Box::new(move |data| { - let _ = channel_.send(data); - }), - ); - } - - Some(channel) - } else { - None - } + .map(|callback_id| Self::from_ipc(window, CallbackFn(callback_id))) } /// The channel identifier. - pub fn id(&self) -> CallbackFn { + pub fn id(&self) -> usize { self.id } /// Sends the given data through the channel. pub fn send(&self, data: T) -> crate::Result<()> { - use crate::Manager; - let body = data.body()?; - let data_id = rand::random(); - self - .window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - self.window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", - self.id.0 - )) + (self.on_message)(body) } } -impl<'de, R: Runtime> CommandArg<'de, R> for Channel { +impl<'de, R: Runtime> CommandArg<'de, R> for Channel { /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`Channel`]. fn from_command(command: CommandItem<'de, R>) -> Result { let name = command.name; diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 82b8fc5285a0..9e507db4684f 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -4,7 +4,7 @@ use super::{PluginApi, PluginHandle}; -use crate::{ipc::CallbackFn, AppHandle, Runtime}; +use crate::{ipc::Channel, AppHandle, Runtime}; #[cfg(target_os = "android")] use crate::{ runtime::RuntimeHandle, @@ -23,11 +23,10 @@ use std::{ type PluginResponse = Result; type PendingPluginCallHandler = Box; -type ChannelDataHandler = Box; static PENDING_PLUGIN_CALLS: OnceCell>> = OnceCell::new(); -static CHANNELS: OnceCell>> = OnceCell::new(); +static CHANNELS: OnceCell>> = OnceCell::new(); /// Possible errors when invoking a plugin. #[derive(Debug, thiserror::Error)] @@ -50,12 +49,12 @@ pub enum PluginInvokeError { CannotSerializePayload(serde_json::Error), } -pub(crate) fn on_channel_data(id: CallbackFn, handler: ChannelDataHandler) { +pub(crate) fn register_channel(channel: Channel) { CHANNELS .get_or_init(Default::default) .lock() .unwrap() - .insert(id.0 as u64, handler); + .insert(channel.id(), channel); } /// Glue between Rust and the Kotlin code that sends the plugin response back. @@ -110,13 +109,13 @@ pub fn send_channel_data( let data: serde_json::Value = serde_json::from_str(env.get_string(data_str).unwrap().to_str().unwrap()).unwrap(); - if let Some(handler) = CHANNELS + if let Some(channel) = CHANNELS .get_or_init(Default::default) .lock() .unwrap() - .get(&(channel_id as u64)) + .get(&(channel_id as usize)) { - handler(data); + let _ = channel.send(data); } } @@ -351,14 +350,14 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + CStr::from_ptr(payload) }; - if let Some(handler) = CHANNELS + if let Some(channel) = CHANNELS .get_or_init(Default::default) .lock() .unwrap() - .get(&id) + .get(&(id as usize)) { - let payload = serde_json::from_str(payload.to_str().unwrap()).unwrap(); - handler(payload); + let payload: serde_json::Value = serde_json::from_str(payload.to_str().unwrap()).unwrap(); + let _ = channel.send(payload); } } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 61f9a9085111..404ed067bfd8 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1740,7 +1740,7 @@ impl Window { match &response { InvokeResponse::Ok(InvokeBody::Json(v)) => { if matches!(v, JsonValue::Object(_) | JsonValue::Array(_)) { - let _ = Channel::new(window.clone(), callback).send(v); + let _ = Channel::from_ipc(window.clone(), callback).send(v); } else { responder_eval( &window, @@ -1750,7 +1750,8 @@ impl Window { } } InvokeResponse::Ok(InvokeBody::Raw(v)) => { - let _ = Channel::new(window.clone(), callback).send(InvokeBody::Raw(v.clone())); + let _ = + Channel::from_ipc(window.clone(), callback).send(InvokeBody::Raw(v.clone())); } InvokeResponse::Err(e) => responder_eval( &window, diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index 13e428037e37..0cb1a5a629d2 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -12,7 +12,7 @@ mod cmd; mod tray; use serde::Serialize; -use tauri::{window::WindowBuilder, App, AppHandle, RunEvent, Runtime, WindowUrl}; +use tauri::{ipc::Channel, window::WindowBuilder, App, AppHandle, RunEvent, Runtime, WindowUrl}; use tauri_plugin_sample::{PingRequest, SampleExt}; #[derive(Clone, Serialize)] @@ -66,6 +66,10 @@ pub fn run_app) + Send + 'static>( let value = Some("test".to_string()); let response = app.sample().ping(PingRequest { value: value.clone(), + on_event: Channel::new(|event| { + println!("got channel event: {:?}", event); + Ok(()) + }), }); log::info!("got response: {:?}", response); if let Ok(res) = response { diff --git a/examples/api/src-tauri/tauri-plugin-sample/android/src/main/java/com/plugin/sample/ExamplePlugin.kt b/examples/api/src-tauri/tauri-plugin-sample/android/src/main/java/com/plugin/sample/ExamplePlugin.kt index 74ee8396e179..69f11898eac5 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/android/src/main/java/com/plugin/sample/ExamplePlugin.kt +++ b/examples/api/src-tauri/tauri-plugin-sample/android/src/main/java/com/plugin/sample/ExamplePlugin.kt @@ -17,6 +17,11 @@ class ExamplePlugin(private val activity: Activity): Plugin(activity) { @Command fun ping(invoke: Invoke) { + val onEvent = invoke.getChannel("onEvent") + val event = JSObject() + event.put("kind", "ping") + onEvent?.send(event) + val value = invoke.getString("value") ?: "" val ret = JSObject() ret.put("value", implementation.pong(value)) diff --git a/examples/api/src-tauri/tauri-plugin-sample/ios/Sources/ExamplePlugin.swift b/examples/api/src-tauri/tauri-plugin-sample/ios/Sources/ExamplePlugin.swift index 8837a5a7be84..9774ba895dd0 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/ios/Sources/ExamplePlugin.swift +++ b/examples/api/src-tauri/tauri-plugin-sample/ios/Sources/ExamplePlugin.swift @@ -2,19 +2,22 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +import SwiftRs +import Tauri import UIKit import WebKit -import Tauri -import SwiftRs class ExamplePlugin: Plugin { - @objc public func ping(_ invoke: Invoke) throws { - let value = invoke.getString("value") - invoke.resolve(["value": value as Any]) - } + @objc public func ping(_ invoke: Invoke) throws { + let onEvent = invoke.getChannel("onEvent") + onEvent?.send(["kind": "ping"]) + + let value = invoke.getString("value") + invoke.resolve(["value": value as Any]) + } } @_cdecl("init_plugin_sample") func initPlugin() -> Plugin { - return ExamplePlugin() + return ExamplePlugin() } diff --git a/examples/api/src-tauri/tauri-plugin-sample/src/desktop.rs b/examples/api/src-tauri/tauri-plugin-sample/src/desktop.rs index a0b975f776c4..b96655d6ce39 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/src/desktop.rs +++ b/examples/api/src-tauri/tauri-plugin-sample/src/desktop.rs @@ -17,8 +17,14 @@ pub fn init( /// A helper class to access the sample APIs. pub struct Sample(AppHandle); +#[derive(serde::Serialize)] +struct Event { + kind: &'static str, +} + impl Sample { pub fn ping(&self, payload: PingRequest) -> crate::Result { + let _ = payload.on_event.send(Event { kind: "ping" }); Ok(PingResponse { value: payload.value, }) diff --git a/examples/api/src-tauri/tauri-plugin-sample/src/models.rs b/examples/api/src-tauri/tauri-plugin-sample/src/models.rs index e2ea913d36d1..3c824a58912c 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/src/models.rs +++ b/examples/api/src-tauri/tauri-plugin-sample/src/models.rs @@ -3,10 +3,13 @@ // SPDX-License-Identifier: MIT use serde::{Deserialize, Serialize}; +use tauri::ipc::Channel; -#[derive(Debug, Serialize)] +#[derive(Serialize)] pub struct PingRequest { pub value: Option, + #[serde(rename = "onEvent")] + pub on_event: Channel, } #[derive(Debug, Clone, Default, Deserialize)] From c8efbdce7d74444a48fb719126c6b8d17f035ce2 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 22 Jun 2023 18:24:58 -0300 Subject: [PATCH 47/90] change files --- .changes/channel-rust.md | 5 +++++ .changes/config.json | 3 ++- .changes/ipc-custom-protocol.md | 6 ++++++ .changes/ipc-refactor.md | 6 ++++++ .changes/linux-ipc-body-feature.md | 5 +++++ .changes/linux-protocol-body-feature.md | 5 +++++ 6 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .changes/channel-rust.md create mode 100644 .changes/ipc-custom-protocol.md create mode 100644 .changes/ipc-refactor.md create mode 100644 .changes/linux-ipc-body-feature.md create mode 100644 .changes/linux-protocol-body-feature.md diff --git a/.changes/channel-rust.md b/.changes/channel-rust.md new file mode 100644 index 000000000000..d951507b2662 --- /dev/null +++ b/.changes/channel-rust.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Added `Channel::new` allowing communication from a mobile plugin with Rust. diff --git a/.changes/config.json b/.changes/config.json index 0969381b137c..7fb05912edf6 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -8,7 +8,8 @@ "pref": "Performance Improvements", "changes": "What's Changed", "sec": "Security fixes", - "deps": "Dependencies" + "deps": "Dependencies", + "breaking": "Breaking Changes" }, "defaultChangeTag": "changes", "pkgManagers": { diff --git a/.changes/ipc-custom-protocol.md b/.changes/ipc-custom-protocol.md new file mode 100644 index 000000000000..f3b99fb691b9 --- /dev/null +++ b/.changes/ipc-custom-protocol.md @@ -0,0 +1,6 @@ +--- +"tauri": patch:enhance +"tauri-utils": patch:enhance +--- + +Use custom protocols on the IPC implementation to enhance performance. diff --git a/.changes/ipc-refactor.md b/.changes/ipc-refactor.md new file mode 100644 index 000000000000..6fd4527b56a4 --- /dev/null +++ b/.changes/ipc-refactor.md @@ -0,0 +1,6 @@ +--- +"tauri": patch:breaking +"tauri-macros": patch:breaking +--- + +Moved `tauri::api::ipc` to `tauri::ipc` and refactored all types. diff --git a/.changes/linux-ipc-body-feature.md b/.changes/linux-ipc-body-feature.md new file mode 100644 index 000000000000..a80dbc0fdd35 --- /dev/null +++ b/.changes/linux-ipc-body-feature.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:breaking +--- + +Removed the `linux-protocol-headers` feature (now always enabled) and added `linux-ipc-protocol`. diff --git a/.changes/linux-protocol-body-feature.md b/.changes/linux-protocol-body-feature.md new file mode 100644 index 000000000000..9542fbdd8a32 --- /dev/null +++ b/.changes/linux-protocol-body-feature.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch:breaking +--- + +Removed the `linux-headers` feature (now always enabled) and added `linux-protocol-body`. From 970547b8aaff7f2f89dfe724bda4fea7b9b9d475 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 16:49:20 -0300 Subject: [PATCH 48/90] turn channel data handler into a plugin --- core/tauri/src/app.rs | 8 +- core/tauri/src/ipc/channel.rs | 141 ++++++++++++++++++++++++++++++++++ core/tauri/src/ipc/mod.rs | 111 ++------------------------ core/tauri/src/window.rs | 27 +------ 4 files changed, 154 insertions(+), 133 deletions(-) create mode 100644 core/tauri/src/ipc/channel.rs diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 31d161ab88a1..683849fac74d 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -8,7 +8,7 @@ pub(crate) mod tray; use crate::{ command::{CommandArg, CommandItem}, ipc::{ - CallbackFn, ChannelDataCache, Invoke, InvokeError, InvokeHandler, InvokeResponder, + channel::ChannelDataCache, CallbackFn, Invoke, InvokeError, InvokeHandler, InvokeResponder, InvokeResponse, }, manager::{Asset, CustomProtocol, WindowManager}, @@ -854,7 +854,7 @@ impl Builder { invoke_initialization_script: InvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, os_name: std::env::consts::OS, - fetch_channel_data_command_prefix: crate::ipc::FETCH_CHANNEL_DATA_COMMAND_PREFIX, + fetch_channel_data_command_prefix: crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND_PREFIX, } .render_default(&Default::default()) .unwrap() @@ -1368,7 +1368,9 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); - app.manage(ChannelDataCache::default()); + let cache = ChannelDataCache::default(); + app.manage(cache.clone()); + app.handle.plugin(crate::ipc::channel::plugin(cache))?; #[cfg(windows)] { diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs new file mode 100644 index 000000000000..0a1e69cb4d31 --- /dev/null +++ b/core/tauri/src/ipc/channel.rs @@ -0,0 +1,141 @@ +use std::{ + collections::HashMap, + sync::{Arc, Mutex}, +}; + +use serde::{Deserialize, Serialize, Serializer}; + +use crate::{ + command::{CommandArg, CommandItem}, + plugin::{Builder as PluginBuilder, TauriPlugin}, + Manager, Runtime, Window, +}; + +use super::{CallbackFn, InvokeBody, InvokeError, IpcResponse}; + +pub(crate) const IPC_PAYLOAD_PREFIX: &str = "__CHANNEL__:"; +const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; +const PLUGIN_FETCH_COMMAND_PREFIX: &str = "fetch?"; +// TODO: ideally this const references CHANNEL_PLUGIN_NAME and PLUGIN_FETCH_COMMAND_PREFIX +pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "plugin:__TAURI_CHANNEL__|fetch?"; + +#[derive(Default, Clone)] +pub struct ChannelDataCache(pub(crate) Arc>>); + +/// An IPC channel. +#[derive(Clone)] +pub struct Channel { + id: usize, + on_message: Arc crate::Result<()> + Send + Sync>, +} + +impl Serialize for Channel { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&format!("{IPC_PAYLOAD_PREFIX}{}", self.id)) + } +} + +impl Channel { + /// Creates a new channel with the given message handler. + pub fn new crate::Result<()> + Send + Sync + 'static>( + on_message: F, + ) -> Self { + Self::_new(rand::random(), on_message) + } + + pub(crate) fn _new crate::Result<()> + Send + Sync + 'static>( + id: usize, + on_message: F, + ) -> Self { + #[allow(clippy::let_and_return)] + let channel = Self { + id, + on_message: Arc::new(on_message), + }; + + #[cfg(mobile)] + crate::plugin::mobile::register_channel(channel.clone()); + + channel + } + + pub(crate) fn from_ipc(window: Window, callback: CallbackFn) -> Self { + Channel::_new(callback.0, move |body| { + let data_id = rand::random(); + window + .state::() + .0 + .lock() + .unwrap() + .insert(data_id, body); + window.eval(&format!( + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", + callback.0 + )) + }) + } + + pub(crate) fn load_from_ipc( + window: Window, + value: impl AsRef, + ) -> Option { + value + .as_ref() + .split_once(IPC_PAYLOAD_PREFIX) + .and_then(|(_prefix, id)| id.parse().ok()) + .map(|callback_id| Self::from_ipc(window, CallbackFn(callback_id))) + } + + /// The channel identifier. + pub fn id(&self) -> usize { + self.id + } + + /// Sends the given data through the channel. + pub fn send(&self, data: T) -> crate::Result<()> { + let body = data.body()?; + (self.on_message)(body) + } +} + +impl<'de, R: Runtime> CommandArg<'de, R> for Channel { + /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`Channel`]. + fn from_command(command: CommandItem<'de, R>) -> Result { + let name = command.name; + let arg = command.key; + let window = command.message.window(); + let value: String = + Deserialize::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e))?; + Channel::load_from_ipc(window, &value).ok_or_else(|| { + InvokeError::from_anyhow(anyhow::anyhow!( + "invalid channel value `{value}`, expected a string in the `{IPC_PAYLOAD_PREFIX}ID` format" + )) + }) + } +} + +pub fn plugin(cache: ChannelDataCache) -> TauriPlugin { + PluginBuilder::new(CHANNEL_PLUGIN_NAME) + .invoke_handler(move |invoke| { + // send channel data + if let Some(id) = invoke + .message + .command + .split_once(PLUGIN_FETCH_COMMAND_PREFIX) + .and_then(|(_, id)| id.parse().ok()) + { + if let Some(data) = cache.0.lock().unwrap().remove(&id) { + invoke.resolver.resolve(data); + } else { + invoke.resolver.reject("Data not found"); + } + true + } else { + false + } + }) + .build() +} diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index 442b59c3d486..e3f5222bac3c 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -6,10 +6,7 @@ //! //! This module includes utilities to send messages to the JS layer of the webview. -use std::{ - collections::HashMap, - sync::{Arc, Mutex}, -}; +use std::sync::Arc; use futures_util::Future; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -19,13 +16,16 @@ use tauri_macros::default_runtime; use crate::{ command::{CommandArg, CommandItem}, - Manager, Runtime, StateManager, Window, + Runtime, StateManager, Window, }; +pub(crate) mod channel; #[cfg(not(ipc_custom_protocol))] pub(crate) mod format_callback; pub(crate) mod protocol; +pub use channel::Channel; + /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; @@ -35,107 +35,6 @@ pub type InvokeResponder = type OwnedInvokeResponder = dyn Fn(Window, String, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static; -pub(crate) const CHANNEL_PREFIX: &str = "__CHANNEL__:"; -pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "__tauriFetchChannelData__:"; - -#[derive(Default)] -pub(crate) struct ChannelDataCache(pub(crate) Mutex>); - -/// An IPC channel. -#[derive(Clone)] -pub struct Channel { - id: usize, - on_message: Arc crate::Result<()> + Send + Sync>, -} - -impl Serialize for Channel { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&format!("{CHANNEL_PREFIX}{}", self.id)) - } -} - -impl Channel { - /// Creates a new channel with the given message handler. - pub fn new crate::Result<()> + Send + Sync + 'static>( - on_message: F, - ) -> Self { - Self::_new(rand::random(), on_message) - } - - pub(crate) fn _new crate::Result<()> + Send + Sync + 'static>( - id: usize, - on_message: F, - ) -> Self { - #[allow(clippy::let_and_return)] - let channel = Self { - id, - on_message: Arc::new(on_message), - }; - - #[cfg(mobile)] - crate::plugin::mobile::register_channel(channel.clone()); - - channel - } - - pub(crate) fn from_ipc(window: Window, callback: CallbackFn) -> Self { - Channel::_new(callback.0, move |body| { - let data_id = rand::random(); - window - .state::() - .0 - .lock() - .unwrap() - .insert(data_id, body); - window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", - callback.0 - )) - }) - } - - pub(crate) fn load_from_ipc( - window: Window, - value: impl AsRef, - ) -> Option { - value - .as_ref() - .split_once(CHANNEL_PREFIX) - .and_then(|(_prefix, id)| id.parse().ok()) - .map(|callback_id| Self::from_ipc(window, CallbackFn(callback_id))) - } - - /// The channel identifier. - pub fn id(&self) -> usize { - self.id - } - - /// Sends the given data through the channel. - pub fn send(&self, data: T) -> crate::Result<()> { - let body = data.body()?; - (self.on_message)(body) - } -} - -impl<'de, R: Runtime> CommandArg<'de, R> for Channel { - /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`Channel`]. - fn from_command(command: CommandItem<'de, R>) -> Result { - let name = command.name; - let arg = command.key; - let window = command.message.window(); - let value: String = - Deserialize::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e))?; - Channel::load_from_ipc(window, &value).ok_or_else(|| { - InvokeError::from_anyhow(anyhow::anyhow!( - "invalid channel value `{value}`, expected a string in the `{CHANNEL_PREFIX}ID` format" - )) - }) - } -} - /// Possible values of an IPC payload. #[derive(Debug, Clone)] pub enum InvokeBody { diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 404ed067bfd8..80d8246163e3 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -17,8 +17,8 @@ use crate::{ command::{CommandArg, CommandItem}, event::{Event, EventHandler}, ipc::{ - CallbackFn, ChannelDataCache, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, - InvokeResponse, FETCH_CHANNEL_DATA_COMMAND_PREFIX, + channel::FETCH_CHANNEL_DATA_COMMAND_PREFIX, CallbackFn, Invoke, InvokeBody, InvokeError, + InvokeMessage, InvokeResolver, InvokeResponse, }, manager::WindowManager, runtime::{ @@ -1783,27 +1783,6 @@ impl Window { Err(e) => resolver.reject(e.to_string()), }, _ => { - // send channel data - if let Some(id) = request - .cmd - .split_once(FETCH_CHANNEL_DATA_COMMAND_PREFIX) - .and_then(|(_, id)| id.parse().ok()) - { - if let Some(data) = self - .state::() - .0 - .lock() - .unwrap() - .remove(&id) - { - resolver.resolve(data); - } else { - resolver.reject("Data not found"); - } - - return rx; - } - #[cfg(mobile)] let app_handle = self.app_handle.clone(); @@ -1855,7 +1834,7 @@ impl Window { if let serde_json::Value::Object(map) = payload { for v in map.values() { if let serde_json::Value::String(s) = v { - if s.starts_with(crate::ipc::CHANNEL_PREFIX) { + if s.starts_with(crate::ipc::channel::IPC_PAYLOAD_PREFIX) { crate::ipc::Channel::load_from_ipc(window.clone(), s); } } From f4c2c5658058df68cacbb90065dcb3dddfacf4f2 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 16:50:18 -0300 Subject: [PATCH 49/90] update InvokeArgs type --- core/tauri/scripts/bundle.global.js | 2 +- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index b4bf33d7c0c5..eb1111406fa4 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},W=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(P(n,e,"read from private field"),i?i.call(n):e.get(n)),D=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},w=(n,e,i,o)=>(P(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>A,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){w(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:e})})}function k(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var A=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(A||{});async function b(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function I(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>b(n,o))}async function U(n,e,i){return I(n,o=>{e(o),b(n,o.id).catch(()=>{})},i)}async function F(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>nn,runtimeDir:()=>rn,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function rn(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var i in r)m(n,i,{get:r[i],enumerable:!0})},W=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>r[a],enumerable:!(o=C(r,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,r,i)=>{if(!r.has(n))throw TypeError("Cannot "+i)};var _=(n,r,i)=>(P(n,r,"read from private field"),i?i.call(n):r.get(n)),D=(n,r,i)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,i)},w=(n,r,i,o)=>(P(n,r,"write to private field"),o?o.call(n,i):r.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>A,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,r=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(r&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(r=>{_(this,c).call(this,r)})}set onmessage(r){w(this,c,r)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(r,i,o){this.plugin=r,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,r,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:r,handler:o}).then(()=>new d(n,r,o.id))}async function t(n,r={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:r})})}function k(n,r="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${r}.localhost/${i}`:`${r}://localhost/${i}`}var A=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(A||{});async function b(n,r){await t("plugin:event|unlisten",{event:n,eventId:r})}async function I(n,r,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(r)}).then(o=>async()=>b(n,o))}async function U(n,r,i){return I(n,o=>{r(o),b(n,o.id).catch(()=>{})},i)}async function F(n,r,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:r})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>rn,resourceDir:()=>nn,runtimeDir:()=>en,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template",e))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function rn(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function en(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,r){return t("plugin:path|basename",{path:n,ext:r})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index e8cab1e50ffc..afd6940c61d7 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n switch (cmd) {\n case \"add\":\n return (args.a as number) + (args.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, args) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"args","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/path\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":66,"character":2}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":66,"character":2}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":62,"character":2}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":62,"character":14}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":62,"character":14}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":61,"character":19}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":6},{"fileName":"tauri.ts","line":76,"character":6}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":19}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":19}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":2}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":25}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":72,"character":25}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":80,"character":2}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":80,"character":2}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":58,"character":6}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":90,"character":2}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":90,"character":2}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":88,"character":2}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":86,"character":2}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":96,"character":8}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":96,"character":2}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":85,"character":6}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":128,"character":5}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":15}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":111,"character":0}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":114,"character":6}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":114,"character":6}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":194,"character":9}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self'; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":194,"character":0}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":144,"character":15}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":144,"character":0}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":36,"character":9}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":36,"character":0}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":37,"character":13}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":37,"character":13}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"args"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L119"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L119"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L68"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L68"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L85"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L102"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L102"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L531"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L531"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L141"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L141"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L664"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L664"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L163"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L163"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L185"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L185"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L207"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L207"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L571"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L571"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L229"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L229"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L630"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L630"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L251"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L251"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L273"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L273"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L295"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L295"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L646"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L646"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L317"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L317"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L339"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L339"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L678"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L678"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L615"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L615"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L361"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L361"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L600"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L600"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L383"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L383"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L405"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L405"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L585"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L585"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L442"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L442"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L422"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L422"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L465"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L465"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L560"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L547"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L547"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L487"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L487"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L509"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L509"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L82"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L125"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 07558b2dc86f..496377a978af 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -122,7 +122,7 @@ async function addPluginListener( * * @since 1.0.0 */ -type InvokeArgs = Record +type InvokeArgs = Record | number[] | ArrayBuffer | Uint8Array /** * Sends a message to the backend. From 162299b761f624b0c54bb5298a4ec6eb4f936b3b Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:49:29 -0300 Subject: [PATCH 50/90] expose request headers --- core/tauri-utils/src/pattern/isolation.js | 10 +++- core/tauri/scripts/bundle.global.js | 2 +- core/tauri/scripts/core.js | 5 +- core/tauri/scripts/ipc-protocol.js | 7 +-- core/tauri/src/app.rs | 13 +++-- core/tauri/src/command.rs | 2 +- core/tauri/src/ipc/channel.rs | 55 ++++++++++++---------- core/tauri/src/ipc/mod.rs | 33 ++++++++++--- core/tauri/src/ipc/protocol.rs | 5 +- core/tauri/src/manager.rs | 4 +- core/tauri/src/plugin.rs | 8 ++-- core/tauri/src/window.rs | 22 ++++++--- examples/api/dist/assets/index.js | 12 ++--- examples/api/isolation-dist/index.js | 2 +- examples/api/src-tauri/src/cmd.rs | 11 ++++- examples/isolation/isolation-dist/index.js | 4 +- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 11 ++++- 18 files changed, 132 insertions(+), 76 deletions(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 18e4cad86278..f274b6875759 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -103,8 +103,14 @@ data = await window.__TAURI_ISOLATION_HOOK__(data) } - const { cmd, callback, error, payload } = data - sendMessage({ cmd, callback, error, payload: await encrypt(payload) }) + const { cmd, callback, error, payload, options } = data + sendMessage({ + cmd, + callback, + error, + payload: await encrypt(payload), + options + }) } window.addEventListener('message', payloadHandler, false) diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index eb1111406fa4..286dd7c56e43 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var i in r)m(n,i,{get:r[i],enumerable:!0})},W=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!O.call(n,a)&&a!==i&&m(n,a,{get:()=>r[a],enumerable:!(o=C(r,a))||o.enumerable});return n};var N=n=>W(m({},"__esModule",{value:!0}),n);var P=(n,r,i)=>{if(!r.has(n))throw TypeError("Cannot "+i)};var _=(n,r,i)=>(P(n,r,"read from private field"),i?i.call(n):r.get(n)),D=(n,r,i)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,i)},w=(n,r,i,o)=>(P(n,r,"write to private field"),o?o.call(n,i):r.set(n,i),i);var hn={};l(hn,{event:()=>f,invoke:()=>fn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>A,emit:()=>F,listen:()=>I,once:()=>U});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>k,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,r=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(r&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;D(this,c,()=>{});this.id=u(r=>{_(this,c).call(this,r)})}set onmessage(r){w(this,c,r)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(r,i,o){this.plugin=r,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,r,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:r,handler:o}).then(()=>new d(n,r,o.id))}async function t(n,r={}){return new Promise((i,o)=>{let a=u(g=>{i(g),Reflect.deleteProperty(window,`_${v}`)},!0),v=u(g=>{o(g),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:n,callback:a,error:v,payload:r})})}function k(n,r="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${r}.localhost/${i}`:`${r}://localhost/${i}`}var A=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(A||{});async function b(n,r){await t("plugin:event|unlisten",{event:n,eventId:r})}async function I(n,r,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(r)}).then(o=>async()=>b(n,o))}async function U(n,r,i){return I(n,o=>{r(o),b(n,o.id).catch(()=>{})},i)}async function F(n,r,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:r})}var h={};l(h,{BaseDirectory:()=>R,appCacheDir:()=>S,appConfigDir:()=>x,appDataDir:()=>$,appLocalDataDir:()=>H,appLogDir:()=>sn,audioDir:()=>V,basename:()=>_n,cacheDir:()=>M,configDir:()=>j,dataDir:()=>z,delimiter:()=>un,desktopDir:()=>G,dirname:()=>gn,documentDir:()=>q,downloadDir:()=>J,executableDir:()=>K,extname:()=>mn,fontDir:()=>Q,homeDir:()=>Y,isAbsolute:()=>yn,join:()=>dn,localDataDir:()=>Z,normalize:()=>pn,pictureDir:()=>X,publicDir:()=>B,resolve:()=>ln,resolveResource:()=>rn,resourceDir:()=>nn,runtimeDir:()=>en,sep:()=>cn,tempDir:()=>an,templateDir:()=>tn,videoDir:()=>on});var R=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template",e))(R||{});async function x(){return t("plugin:path|resolve_directory",{directory:13})}async function $(){return t("plugin:path|resolve_directory",{directory:14})}async function H(){return t("plugin:path|resolve_directory",{directory:15})}async function S(){return t("plugin:path|resolve_directory",{directory:16})}async function V(){return t("plugin:path|resolve_directory",{directory:1})}async function M(){return t("plugin:path|resolve_directory",{directory:2})}async function j(){return t("plugin:path|resolve_directory",{directory:3})}async function z(){return t("plugin:path|resolve_directory",{directory:4})}async function G(){return t("plugin:path|resolve_directory",{directory:18})}async function q(){return t("plugin:path|resolve_directory",{directory:6})}async function J(){return t("plugin:path|resolve_directory",{directory:7})}async function K(){return t("plugin:path|resolve_directory",{directory:19})}async function Q(){return t("plugin:path|resolve_directory",{directory:20})}async function Y(){return t("plugin:path|resolve_directory",{directory:21})}async function Z(){return t("plugin:path|resolve_directory",{directory:5})}async function X(){return t("plugin:path|resolve_directory",{directory:8})}async function B(){return t("plugin:path|resolve_directory",{directory:9})}async function nn(){return t("plugin:path|resolve_directory",{directory:11})}async function rn(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function en(){return t("plugin:path|resolve_directory",{directory:22})}async function tn(){return t("plugin:path|resolve_directory",{directory:23})}async function on(){return t("plugin:path|resolve_directory",{directory:10})}async function sn(){return t("plugin:path|resolve_directory",{directory:17})}async function an(n){return t("plugin:path|resolve_directory",{directory:12})}function cn(){return window.__TAURI__.path.__sep}function un(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function pn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function gn(n){return t("plugin:path|dirname",{path:n})}async function mn(n){return t("plugin:path|extname",{path:n})}async function _n(n,r){return t("plugin:path|basename",{path:n,ext:r})}async function yn(n){return t("plugin:path|isAbsolute",{path:n})}var fn=t;return N(hn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},N=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!W.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var k=n=>N(m({},"__esModule",{value:!0}),n);var D=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(D(n,e,"read from private field"),i?i.call(n):e.get(n)),w=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},A=(n,e,i,o)=>(D(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var vn={};l(vn,{event:()=>f,invoke:()=>hn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>b,emit:()=>x,listen:()=>R,once:()=>F});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>U,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;w(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){A(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={},i){return new Promise((o,a)=>{let v=u(g=>{o(g),Reflect.deleteProperty(window,`_${P}`)},!0),P=u(g=>{a(g),Reflect.deleteProperty(window,`_${v}`)},!0);window.__TAURI_IPC__({cmd:n,callback:v,error:P,payload:e,options:i})})}function U(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function I(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function R(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>I(n,o))}async function F(n,e,i){return R(n,o=>{e(o),I(n,o.id).catch(()=>{})},i)}async function x(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>O,appCacheDir:()=>V,appConfigDir:()=>$,appDataDir:()=>H,appLocalDataDir:()=>S,appLogDir:()=>an,audioDir:()=>M,basename:()=>yn,cacheDir:()=>j,configDir:()=>z,dataDir:()=>G,delimiter:()=>ln,desktopDir:()=>q,dirname:()=>mn,documentDir:()=>J,downloadDir:()=>K,executableDir:()=>Q,extname:()=>_n,fontDir:()=>Y,homeDir:()=>Z,isAbsolute:()=>fn,join:()=>gn,localDataDir:()=>X,normalize:()=>dn,pictureDir:()=>B,publicDir:()=>nn,resolve:()=>pn,resolveResource:()=>rn,resourceDir:()=>en,runtimeDir:()=>tn,sep:()=>un,tempDir:()=>cn,templateDir:()=>on,videoDir:()=>sn});var O=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(O||{});async function $(){return t("plugin:path|resolve_directory",{directory:13})}async function H(){return t("plugin:path|resolve_directory",{directory:14})}async function S(){return t("plugin:path|resolve_directory",{directory:15})}async function V(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function j(){return t("plugin:path|resolve_directory",{directory:2})}async function z(){return t("plugin:path|resolve_directory",{directory:3})}async function G(){return t("plugin:path|resolve_directory",{directory:4})}async function q(){return t("plugin:path|resolve_directory",{directory:18})}async function J(){return t("plugin:path|resolve_directory",{directory:6})}async function K(){return t("plugin:path|resolve_directory",{directory:7})}async function Q(){return t("plugin:path|resolve_directory",{directory:19})}async function Y(){return t("plugin:path|resolve_directory",{directory:20})}async function Z(){return t("plugin:path|resolve_directory",{directory:21})}async function X(){return t("plugin:path|resolve_directory",{directory:5})}async function B(){return t("plugin:path|resolve_directory",{directory:8})}async function nn(){return t("plugin:path|resolve_directory",{directory:9})}async function en(){return t("plugin:path|resolve_directory",{directory:11})}async function rn(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function tn(){return t("plugin:path|resolve_directory",{directory:22})}async function on(){return t("plugin:path|resolve_directory",{directory:23})}async function sn(){return t("plugin:path|resolve_directory",{directory:10})}async function an(){return t("plugin:path|resolve_directory",{directory:17})}async function cn(n){return t("plugin:path|resolve_directory",{directory:12})}function un(){return window.__TAURI__.path.__sep}function ln(){return window.__TAURI__.path.__delimiter}async function pn(...n){return t("plugin:path|resolve",{paths:n})}async function dn(n){return t("plugin:path|normalize",{path:n})}async function gn(...n){return t("plugin:path|join",{paths:n})}async function mn(n){return t("plugin:path|dirname",{path:n})}async function _n(n){return t("plugin:path|extname",{path:n})}async function yn(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function fn(n){return t("plugin:path|isAbsolute",{path:n})}var hn=t;return k(vn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 85aeb6c8bb87..044a2f4bf5d1 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -55,7 +55,7 @@ } } - window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}) { + window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}, options) { return new Promise(function (resolve, reject) { var callback = window.__TAURI__.transformCallback(function (r) { resolve(r) @@ -71,7 +71,8 @@ cmd, callback, error, - payload + payload, + options }) } if (window.__TAURI_IPC__) { diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 180a2b6a6bf8..b20a40c67550 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -5,12 +5,12 @@ (function () { const processIpcMessage = __RAW_process_ipc_message_fn__ const osName = __TEMPLATE_os_name__ - const fetchChannelDataCommandPrefix = __TEMPLATE_fetch_channel_data_command_prefix__ + const fetchChannelDataCommand = __TEMPLATE_fetch_channel_data_command__ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { - const { cmd, callback, error, payload } = message - if ((osName === 'linux' || osName === 'android') && !cmd.startsWith(fetchChannelDataCommandPrefix)) { + const { cmd, callback, error, payload, options } = message + if ((osName === 'linux' || osName === 'android') && cmd != fetchChannelDataCommand) { const { data } = processIpcMessage({ cmd, callback, error, ...payload }) window.ipc.postMessage(data) } else { @@ -22,6 +22,7 @@ 'Content-Type': contentType, 'Tauri-Callback': callback, 'Tauri-Error': error, + ...options?.headers } }).then((response) => { const cb = response.ok ? callback : error diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 683849fac74d..29f3f35f4574 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -839,7 +839,7 @@ struct InvokeInitializationScript<'a> { #[raw] process_ipc_message_fn: &'a str, os_name: &'a str, - fetch_channel_data_command_prefix: &'a str, + fetch_channel_data_command: &'a str, } impl Builder { @@ -854,7 +854,7 @@ impl Builder { invoke_initialization_script: InvokeInitializationScript { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, os_name: std::env::consts::OS, - fetch_channel_data_command_prefix: crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND_PREFIX, + fetch_channel_data_command: crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND, } .render_default(&Default::default()) .unwrap() @@ -906,7 +906,7 @@ impl Builder { #[must_use] pub fn invoke_handler(mut self, invoke_handler: F) -> Self where - F: Fn(Invoke) -> bool + Send + Sync + 'static, + F: Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static, { self.invoke_handler = Box::new(invoke_handler); self @@ -917,7 +917,7 @@ impl Builder { /// The `responder` is a function that will be called when a command has been executed and must send a response to the JS layer. /// /// The `initialization_script` is a script that initializes `window.__TAURI_POST_MESSAGE__`. - /// That function must take the `message: object` argument and send it to the backend. + /// That function must take the `(message: object, options: object)` arguments and send it to the backend. #[must_use] pub fn invoke_system(mut self, initialization_script: String, responder: F) -> Self where @@ -1368,9 +1368,8 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); - let cache = ChannelDataCache::default(); - app.manage(cache.clone()); - app.handle.plugin(crate::ipc::channel::plugin(cache))?; + app.manage(ChannelDataCache::default()); + app.handle.plugin(crate::ipc::channel::plugin())?; #[cfg(windows)] { diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index f3da5359dcf5..3655214aa5a5 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -25,7 +25,7 @@ pub struct CommandItem<'a, R: Runtime> { pub key: &'static str, /// The [`InvokeMessage`] that was passed to this command. - pub message: &'a InvokeMessage, + pub message: &'a InvokeMessage<'a, R>, } /// Trait implemented by command arguments to derive a value from a [`CommandItem`]. diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index 0a1e69cb4d31..b5233a4bb873 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -6,18 +6,18 @@ use std::{ use serde::{Deserialize, Serialize, Serializer}; use crate::{ + command, command::{CommandArg, CommandItem}, plugin::{Builder as PluginBuilder, TauriPlugin}, - Manager, Runtime, Window, + Manager, Runtime, State, Window, }; -use super::{CallbackFn, InvokeBody, InvokeError, IpcResponse}; +use super::{CallbackFn, InvokeBody, InvokeError, IpcResponse, Request, Response}; pub(crate) const IPC_PAYLOAD_PREFIX: &str = "__CHANNEL__:"; const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; -const PLUGIN_FETCH_COMMAND_PREFIX: &str = "fetch?"; -// TODO: ideally this const references CHANNEL_PLUGIN_NAME and PLUGIN_FETCH_COMMAND_PREFIX -pub(crate) const FETCH_CHANNEL_DATA_COMMAND_PREFIX: &str = "plugin:__TAURI_CHANNEL__|fetch?"; +// TODO: ideally this const references CHANNEL_PLUGIN_NAME +pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "plugin:__TAURI_CHANNEL__|fetch"; #[derive(Default, Clone)] pub struct ChannelDataCache(pub(crate) Arc>>); @@ -72,7 +72,7 @@ impl Channel { .unwrap() .insert(data_id, body); window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND_PREFIX}{data_id}').then(window['_' + {}])", + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ 'Tauri-Channel-Id': {data_id} }} }}).then(window['_' + {}])", callback.0 )) }) @@ -117,25 +117,30 @@ impl<'de, R: Runtime> CommandArg<'de, R> for Channel { } } -pub fn plugin(cache: ChannelDataCache) -> TauriPlugin { +#[command(root = "crate")] +fn fetch( + request: Request<'_>, + cache: State<'_, ChannelDataCache>, +) -> Result { + println!("fetch {:?}", request); + if let Some(id) = request + .headers() + .get("Tauri-Channel-Id") + .and_then(|v| v.to_str().ok()) + .and_then(|id| id.parse().ok()) + { + if let Some(data) = cache.0.lock().unwrap().remove(&id) { + Ok(Response::new(data)) + } else { + Err("data not found") + } + } else { + Err("missing Tauri-Channel-Id header") + } +} + +pub fn plugin() -> TauriPlugin { PluginBuilder::new(CHANNEL_PLUGIN_NAME) - .invoke_handler(move |invoke| { - // send channel data - if let Some(id) = invoke - .message - .command - .split_once(PLUGIN_FETCH_COMMAND_PREFIX) - .and_then(|(_, id)| id.parse().ok()) - { - if let Some(data) = cache.0.lock().unwrap().remove(&id) { - invoke.resolver.resolve(data); - } else { - invoke.resolver.reject("Data not found"); - } - true - } else { - false - } - }) + .invoke_handler(crate::generate_handler![fetch]) .build() } diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index e3f5222bac3c..c26724c463db 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -9,6 +9,7 @@ use std::sync::Arc; use futures_util::Future; +use http::HeaderMap; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value as JsonValue; pub use serialize_to_javascript::Options as SerializeOptions; @@ -27,7 +28,7 @@ pub(crate) mod protocol; pub use channel::Channel; /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. -pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; +pub type InvokeHandler = dyn Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static; /// A closure that is responsible for respond a JS message. pub type InvokeResponder = @@ -92,6 +93,7 @@ impl InvokeBody { #[derive(Debug)] pub struct Request<'a> { body: &'a InvokeBody, + headers: &'a HeaderMap, } impl<'a> Request<'a> { @@ -99,13 +101,19 @@ impl<'a> Request<'a> { pub fn body(&self) -> &InvokeBody { self.body } + + /// Thr request headers. + pub fn headers(&self) -> &HeaderMap { + self.headers + } } impl<'a, R: Runtime> CommandArg<'a, R> for Request<'a> { /// Returns the invoke [`Request`]. fn from_command(command: CommandItem<'a, R>) -> Result { Ok(Self { - body: &command.message.payload, + body: command.message.payload(), + headers: command.message.headers(), }) } } @@ -144,9 +152,9 @@ impl Response { /// The message and resolver given to a custom command. #[default_runtime(crate::Wry, wry)] -pub struct Invoke { +pub struct Invoke<'a, R: Runtime> { /// The message passed. - pub message: InvokeMessage, + pub message: InvokeMessage<'a, R>, /// The resolver of the message. pub resolver: InvokeResolver, @@ -394,7 +402,7 @@ impl InvokeResolver { /// An invoke message. #[default_runtime(crate::Wry, wry)] #[derive(Debug)] -pub struct InvokeMessage { +pub struct InvokeMessage<'a, R: Runtime> { /// The window that received the invoke message. pub(crate) window: Window, /// Application managed state. @@ -403,32 +411,37 @@ pub struct InvokeMessage { pub(crate) command: String, /// The JSON argument passed on the invoke message. pub(crate) payload: InvokeBody, + /// The request headers. + pub(crate) headers: &'a HeaderMap, } -impl Clone for InvokeMessage { +impl<'a, R: Runtime> Clone for InvokeMessage<'a, R> { fn clone(&self) -> Self { Self { window: self.window.clone(), state: self.state.clone(), command: self.command.clone(), payload: self.payload.clone(), + headers: self.headers, } } } -impl InvokeMessage { +impl<'a, R: Runtime> InvokeMessage<'a, R> { /// Create an new [`InvokeMessage`] from a payload send to a window. pub(crate) fn new( window: Window, state: Arc, command: String, payload: InvokeBody, + headers: &'a HeaderMap, ) -> Self { Self { window, state, command, payload, + headers, } } @@ -467,6 +480,12 @@ impl InvokeMessage { pub fn state_ref(&self) -> &StateManager { &self.state } + + /// The request headers. + #[inline(always)] + pub fn headers(&self) -> &HeaderMap { + &self.headers + } } /// The `Callback` type is the return value of the `transformCallback` JavaScript function. diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 89b44f2e6b15..f09e0f64905d 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -58,7 +58,7 @@ pub fn get(manager: WindowManager, label: String) -> UriSchemePro let mut r = HttpResponse::new(Vec::new().into()); r.headers_mut().insert( ACCESS_CONTROL_ALLOW_HEADERS, - HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error"), + HeaderValue::from_static("Content-Type, Tauri-Callback, Tauri-Error, Tauri-Channel-Id"), ); r } @@ -130,11 +130,13 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) { Ok(message) => { + let headers = Default::default(); let _ = window.on_message(InvokeRequest { cmd: message.cmd, callback: message.callback, error: message.error, body: message.payload.into(), + headers: &headers, }); } Err(e) => { @@ -225,6 +227,7 @@ fn handle_ipc_request( callback, error, body, + headers: request.headers(), }; let rx = window.on_message(payload); diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 7402f429716c..71d8cf0ca43a 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -921,7 +921,7 @@ mod test { } impl WindowManager { - pub fn run_invoke_handler(&self, invoke: Invoke) -> bool { + pub fn run_invoke_handler(&self, invoke: Invoke<'_, R>) -> bool { (self.inner.invoke_handler)(invoke) } @@ -935,7 +935,7 @@ impl WindowManager { .on_page_load(window, payload); } - pub fn extend_api(&self, plugin: &str, invoke: Invoke) -> bool { + pub fn extend_api(&self, plugin: &str, invoke: Invoke<'_, R>) -> bool { self .inner .plugins diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index 226d488f7a5f..81453eca856f 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -60,7 +60,7 @@ pub trait Plugin: Send { /// Extend commands to [`crate::Builder::invoke_handler`]. #[allow(unused_variables)] - fn extend_api(&mut self, invoke: Invoke) -> bool { + fn extend_api(&mut self, invoke: Invoke<'_, R>) -> bool { false } } @@ -241,7 +241,7 @@ impl Builder { #[must_use] pub fn invoke_handler(mut self, invoke_handler: F) -> Self where - F: Fn(Invoke) -> bool + Send + Sync + 'static, + F: Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static, { self.invoke_handler = Box::new(invoke_handler); self @@ -494,7 +494,7 @@ impl Plugin for TauriPlugin { (self.on_event)(app, event) } - fn extend_api(&mut self, invoke: Invoke) -> bool { + fn extend_api(&mut self, invoke: Invoke<'_, R>) -> bool { (self.invoke_handler)(invoke) } } @@ -588,7 +588,7 @@ impl PluginStore { /// Runs the plugin `extend_api` hook if it exists. Returns whether the invoke message was handled or not. /// /// The message is not handled when the plugin exists **and** the command does not. - pub(crate) fn extend_api(&mut self, plugin: &str, invoke: Invoke) -> bool { + pub(crate) fn extend_api(&mut self, plugin: &str, invoke: Invoke<'_, R>) -> bool { if let Some(plugin) = self.store.get_mut(plugin) { plugin.extend_api(invoke) } else { diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 80d8246163e3..317b6a53c2e7 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -6,6 +6,7 @@ pub(crate) mod menu; +use http::HeaderMap; pub use menu::{MenuEvent, MenuHandle}; pub use tauri_utils::{config::Color, WindowEffect as Effect, WindowEffectState as EffectState}; use url::Url; @@ -17,8 +18,7 @@ use crate::{ command::{CommandArg, CommandItem}, event::{Event, EventHandler}, ipc::{ - channel::FETCH_CHANNEL_DATA_COMMAND_PREFIX, CallbackFn, Invoke, InvokeBody, InvokeError, - InvokeMessage, InvokeResolver, InvokeResponse, + CallbackFn, Invoke, InvokeBody, InvokeError, InvokeMessage, InvokeResolver, InvokeResponse, }, manager::WindowManager, runtime::{ @@ -771,7 +771,7 @@ struct JsEventListenerKey { /// The IPC invoke request. #[derive(Debug)] -pub struct InvokeRequest { +pub struct InvokeRequest<'a> { /// The invoke command. pub cmd: String, /// The success callback. @@ -780,6 +780,8 @@ pub struct InvokeRequest { pub error: CallbackFn, /// The body of the request. pub body: InvokeBody, + /// The request headers. + pub headers: &'a HeaderMap, } // TODO: expand these docs since this is a pretty important type @@ -1679,7 +1681,7 @@ impl Window { } /// Handles this window receiving an [`InvokeRequest`]. - pub fn on_message(self, request: InvokeRequest) -> Receiver { + pub fn on_message(self, request: InvokeRequest<'_>) -> Receiver { let manager = self.manager.clone(); let current_url = self.url(); let is_local = self.is_local_url(¤t_url); @@ -1722,7 +1724,8 @@ impl Window { use serde_json::Value as JsonValue; // the channel data command is the only command that uses a custom protocol on Linux - if custom_responder.is_none() && !cmd.starts_with(FETCH_CHANNEL_DATA_COMMAND_PREFIX) { + if custom_responder.is_none() && cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND + { fn responder_eval( window: &Window, js: crate::api::Result, @@ -1786,8 +1789,13 @@ impl Window { #[cfg(mobile)] let app_handle = self.app_handle.clone(); - let message = - InvokeMessage::new(self, manager.state(), request.cmd.to_string(), request.body); + let message = InvokeMessage::new( + self, + manager.state(), + request.cmd.to_string(), + request.body, + request.headers, + ); let mut invoke = Invoke { message, diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index fb1dc5460f11..7b6e30d6ecc7 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,9 +1,9 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const m of a.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function l(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:m,after_update:c}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);m?m.push(...u):V(u),e.$$.on_mount=[]}),c.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(c){if(he(e,c)&&(e=c,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:m}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const p of a.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:p,after_update:s}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);p?p.push(...u):V(u),e.$$.on_mount=[]}),s.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(s){if(he(e,s)&&(e=s,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:p}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={}){return new Promise((n,i)=>{let r=fe(m=>{n(m),Reflect.deleteProperty(window,`_${a}`)},!0),a=fe(m=>{i(m),Reflect.deleteProperty(window,`_${r}`)},!0);window.__TAURI_IPC__({cmd:e,callback:r,error:a,payload:t})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,m,c,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),m=f("button"),m.textContent="Send event to Rust",l(n,"class","btn"),l(n,"id","log"),l(r,"class","btn"),l(r,"id","request"),l(m,"class","btn"),l(m,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,m),c||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(m,"click",e[2])],c=!0)},p:$,i:$,o:$,d(d){d&&w(t),c=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function m(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,m,c,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
- `,l(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(c){const u=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=c,u.srcObject=c}function m(c){if(c.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return xe(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(r);a(c)}catch(c){m(c)}}),at(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode - `),n=f("div"),l(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode - `),n=f("div"),l(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",m,c,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),m=Q(a),l(n,"class",e[28].icon+" mr-2"),l(t,"href","##"),l(t,"class",c="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,m),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&c!==(c="nv "+(e[1]===e[28]?"nv_selected":""))&&l(t,"class",c)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,m,c,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,p,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(s,T){return s[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(s,T){return s[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let s=0;s{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ `,c(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(s){const u=document.querySelector("video"),d=s.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=s,u.srcObject=s}function p(s){if(s.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else s.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${s.name}`,s)}return xe(async()=>{try{const s=await navigator.mediaDevices.getUserMedia(r);a(s)}catch(s){p(s)}}),at(()=>{window.stream.getTracks().forEach(function(s){s.stop()})}),e.$$set=s=>{"onMessage"in s&&n(0,i=s.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode + `),n=f("div"),c(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode + `),n=f("div"),c(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",p,s,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),p=Q(a),c(n,"class",e[28].icon+" mr-2"),c(t,"href","##"),c(t,"class",s="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,p),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&s!==(s="nv "+(e[1]===e[28]?"nv_selected":""))&&c(t,"class",s)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,p,s,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,m,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(l,T){return l[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(l,T){return l[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let l=0;l`,me=g(),b=f("a"),b.innerHTML=`GitHub `,j=g(),C=f("a"),C.innerHTML=`Source - `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),p=g(),_=f("div");for(let s=0;s',ze=g(),oe=f("div");for(let s=0;s{Re(h,1)}),Dt()}Y?(y=new Y(Ge(s)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=s[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,p=>n(4,i=p));function v(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p,null,1))+"
"},..._])}function S(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+p+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(p){I=p.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const D=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",D)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",D)}let b=!1,j,C,q=!1,B=0,ee=0;const te=(p,_,D)=>Math.min(Math.max(_,p),D);xe(()=>{n(13,j=document.querySelector("#sidebar")),C=document.querySelector("#sidebarToggle"),document.addEventListener("click",p=>{C.contains(p.target)?n(0,b=!b):b&&!j.contains(p.target)&&n(0,b=!1)}),document.addEventListener("touchstart",p=>{if(C.contains(p.target))return;const _=p.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",p=>{if(q){const _=p.touches[0].clientX;ee=_;const D=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-D:18.75-D,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const p=(ee-B)/10;n(0,b=b?p>-(18.75/2):p>18.75/2)}q=!1})});const pe=p=>{c(p),n(0,b=!1)};function ge(p){Ne[p?"unshift":"push"](()=>{O=p,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const p=document.querySelector("#sidebar");p&&rn(p,b)}},[b,m,u,O,i,a,c,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); + `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),m=g(),_=f("div");for(let l=0;l',ze=g(),oe=f("div");for(let l=0;l{Re(h,1)}),Dt()}Y?(y=new Y(Ge(l)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=l[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,m=>n(4,i=m));function v(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof m=="string"?m:JSON.stringify(m,null,1))+"
"},..._])}function S(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+m+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(m){I=m.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const D=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",D)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",D)}let b=!1,j,C,q=!1,B=0,ee=0;const te=(m,_,D)=>Math.min(Math.max(_,m),D);xe(()=>{n(13,j=document.querySelector("#sidebar")),C=document.querySelector("#sidebarToggle"),document.addEventListener("click",m=>{C.contains(m.target)?n(0,b=!b):b&&!j.contains(m.target)&&n(0,b=!1)}),document.addEventListener("touchstart",m=>{if(C.contains(m.target))return;const _=m.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",m=>{if(q){const _=m.touches[0].clientX;ee=_;const D=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-D:18.75-D,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const m=(ee-B)/10;n(0,b=b?m>-(18.75/2):m>18.75/2)}q=!1})});const pe=m=>{s(m),n(0,b=!1)};function ge(m){Ne[m?"unshift":"push"](()=>{O=m,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const m=document.querySelector("#sidebar");m&&rn(m,b)}},[b,p,u,O,i,a,s,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); diff --git a/examples/api/isolation-dist/index.js b/examples/api/isolation-dist/index.js index 7e2df30de85d..84fc82e56088 100644 --- a/examples/api/isolation-dist/index.js +++ b/examples/api/isolation-dist/index.js @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -window.__TAURI_ISOLATION_HOOK__ = (payload) => { +window.__TAURI_ISOLATION_HOOK__ = (payload, options) => { return payload } diff --git a/examples/api/src-tauri/src/cmd.rs b/examples/api/src-tauri/src/cmd.rs index 221881fc1b3b..c7d2ddac7a26 100644 --- a/examples/api/src-tauri/src/cmd.rs +++ b/examples/api/src-tauri/src/cmd.rs @@ -17,8 +17,15 @@ pub fn log_operation(event: String, payload: Option) { log::info!("{} {:?}", event, payload); } +#[derive(serde::Serialize)] +pub struct R { + x: String, +} + #[command] -pub fn perform_request(endpoint: String, body: RequestBody) -> String { +pub fn perform_request(endpoint: String, body: RequestBody) -> R { println!("{} {:?}", endpoint, body); - "message response".into() + R { + x: "message response".into(), + } } diff --git a/examples/isolation/isolation-dist/index.js b/examples/isolation/isolation-dist/index.js index 260fe21d773b..680eae2b3e90 100644 --- a/examples/isolation/isolation-dist/index.js +++ b/examples/isolation/isolation-dist/index.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -window.__TAURI_ISOLATION_HOOK__ = (payload) => { - console.log('hook', payload) +window.__TAURI_ISOLATION_HOOK__ = (payload, options) => { + console.log('hook', payload, options) return payload } diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index afd6940c61d7..e102fa5368f3 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L119"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L119"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L68"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L68"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L85"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L102"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L102"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L531"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L531"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L141"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L141"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L664"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L664"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L163"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L163"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L185"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L185"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L207"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L207"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L571"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L571"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L229"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L229"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L630"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L630"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L251"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L251"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L273"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L273"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L295"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L295"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L646"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L646"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L317"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L317"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L339"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L339"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L678"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L678"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L615"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L615"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L361"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L361"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L600"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L600"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L383"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L383"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L405"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L405"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L585"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L585"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L442"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L442"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L422"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L422"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L465"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L465"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L560"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L547"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L547"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L487"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L487"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L509"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L509"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L82"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L125"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":222,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":191,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L191"}],"signatures":[{"id":223,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":191,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L191"}],"parameters":[{"id":224,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":225,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,222,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/970547b8a/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L119"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L119"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L68"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L68"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L85"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L102"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L102"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L531"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L531"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L141"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L141"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L664"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L664"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L163"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L163"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L185"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L185"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L207"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L207"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L571"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L571"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L229"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L229"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L630"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L630"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L251"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L251"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L273"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L273"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L295"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L295"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L646"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L646"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L317"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L317"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L339"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L339"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L678"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L678"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L615"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L615"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L361"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L361"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L600"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L600"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L383"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L383"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L405"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L405"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L585"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L585"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L442"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L442"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L422"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L422"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L465"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L465"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L560"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L547"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L547"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L487"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L487"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L509"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L509"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L82"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L125"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":223,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":198,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L198"}],"signatures":[{"id":224,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":198,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L198"}],"parameters":[{"id":225,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":226,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":147,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L147"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":147,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L147"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":222,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,223,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 496377a978af..a83ba561c220 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -124,6 +124,11 @@ async function addPluginListener( */ type InvokeArgs = Record | number[] | ArrayBuffer | Uint8Array +/** + * @since 2.0.0 + */ +interface InvokeOptions { headers: Headers | Record } + /** * Sends a message to the backend. * @example @@ -134,11 +139,12 @@ type InvokeArgs = Record | number[] | ArrayBuffer | Uint8Array * * @param cmd The command name. * @param args The optional arguments to pass to the command. + * @param options The request options. * @return A promise resolving or rejecting to the backend response. * * @since 1.0.0 */ -async function invoke(cmd: string, args: InvokeArgs = {}): Promise { +async function invoke(cmd: string, args: InvokeArgs = {}, options?: InvokeOptions): Promise { return new Promise((resolve, reject) => { const callback = transformCallback((e: T) => { resolve(e) @@ -153,7 +159,8 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { cmd, callback, error, - payload: args + payload: args, + options }) }) } From 12a866f0b8f58be8066ee1c7b4bd077b221a114f Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:56:09 -0300 Subject: [PATCH 51/90] change api example to return object --- examples/api/src-tauri/src/cmd.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/api/src-tauri/src/cmd.rs b/examples/api/src-tauri/src/cmd.rs index c7d2ddac7a26..e013e50a3add 100644 --- a/examples/api/src-tauri/src/cmd.rs +++ b/examples/api/src-tauri/src/cmd.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use tauri::command; #[derive(Debug, Deserialize)] @@ -17,15 +17,15 @@ pub fn log_operation(event: String, payload: Option) { log::info!("{} {:?}", event, payload); } -#[derive(serde::Serialize)] -pub struct R { - x: String, +#[derive(Serialize)] +pub struct ApiResponse { + message: String, } #[command] -pub fn perform_request(endpoint: String, body: RequestBody) -> R { +pub fn perform_request(endpoint: String, body: RequestBody) -> ApiResponse { println!("{} {:?}", endpoint, body); - R { - x: "message response".into(), + ApiResponse { + message: "message response".into(), } } From a72f66081bad7f80b59ffbd94f5f7a337322a637 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:56:25 -0300 Subject: [PATCH 52/90] fix usage with linux-ipc-protocol feature --- core/tauri/scripts/ipc-protocol.js | 3 ++- core/tauri/src/app.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index b20a40c67550..a86f9d5e2800 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -6,11 +6,12 @@ const processIpcMessage = __RAW_process_ipc_message_fn__ const osName = __TEMPLATE_os_name__ const fetchChannelDataCommand = __TEMPLATE_fetch_channel_data_command__ + const useCustomProtocol = __TEMPLATE_use_custom_protocol__ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload, options } = message - if ((osName === 'linux' || osName === 'android') && cmd != fetchChannelDataCommand) { + if (!useCustomProtocol && (osName === 'linux' || osName === 'android') && cmd != fetchChannelDataCommand) { const { data } = processIpcMessage({ cmd, callback, error, ...payload }) window.ipc.postMessage(data) } else { diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 29f3f35f4574..d7c721b9f12e 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -840,6 +840,7 @@ struct InvokeInitializationScript<'a> { process_ipc_message_fn: &'a str, os_name: &'a str, fetch_channel_data_command: &'a str, + use_custom_protocol: bool, } impl Builder { @@ -855,6 +856,7 @@ impl Builder { process_ipc_message_fn: crate::manager::PROCESS_IPC_MESSAGE_FN, os_name: std::env::consts::OS, fetch_channel_data_command: crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND, + use_custom_protocol: cfg!(ipc_custom_protocol), } .render_default(&Default::default()) .unwrap() From fb6cbc2212ba6c5b24be4c666a411b7f89eeb325 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:56:42 -0300 Subject: [PATCH 53/90] handle null payload on isolation script --- core/tauri-utils/src/pattern/isolation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index f274b6875759..80fcb753ee68 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -63,7 +63,7 @@ */ function isIsolationMessage(data) { if (typeof data === 'object' && typeof data.payload === 'object') { - const keys = Object.keys(data.payload) + const keys = data.payload ? Object.keys(data.payload) : [] return ( keys.length > 0 && keys.every((key) => key === 'nonce' || key === 'payload') From e442f79f6c754cf5cb1b61a1edc7bf92e8baf48d Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:58:42 -0300 Subject: [PATCH 54/90] change if/else blocks to simplify condition --- core/tauri/scripts/ipc-protocol.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index a86f9d5e2800..21fc4d48ede1 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -11,10 +11,9 @@ Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => { const { cmd, callback, error, payload, options } = message - if (!useCustomProtocol && (osName === 'linux' || osName === 'android') && cmd != fetchChannelDataCommand) { - const { data } = processIpcMessage({ cmd, callback, error, ...payload }) - window.ipc.postMessage(data) - } else { + + // use custom protocol for IPC if the flag is set to true, the command is the fetch data command or when not on Linux/Android + if (useCustomProtocol || cmd == fetchChannelDataCommand || (osName !== 'linux' && osName !== 'android')) { const { contentType, data } = processIpcMessage(payload) fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { method: 'POST', @@ -43,6 +42,10 @@ console.warn(`[TAURI] Couldn't find callback id {cb} in window. This might happen when the app is reloaded while Rust is running an asynchronous operation.`) } }) + } else { + // otherwise use the postMessage interface + const { data } = processIpcMessage({ cmd, callback, error, ...payload }) + window.ipc.postMessage(data) } } }) From 9992bc897cafdea90c7c6465d582c87cbfd668da Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 18:59:55 -0300 Subject: [PATCH 55/90] remove println --- core/tauri/src/ipc/channel.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index b5233a4bb873..8200d4635e03 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -122,7 +122,6 @@ fn fetch( request: Request<'_>, cache: State<'_, ChannelDataCache>, ) -> Result { - println!("fetch {:?}", request); if let Some(id) = request .headers() .get("Tauri-Channel-Id") From b8a91d8045d155279d476dc2ad0779d6d851348d Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 19:10:08 -0300 Subject: [PATCH 56/90] headers must be owned --- core/tauri/src/app.rs | 2 +- core/tauri/src/command.rs | 2 +- core/tauri/src/ipc/mod.rs | 18 +++++++++--------- core/tauri/src/ipc/protocol.rs | 5 ++--- core/tauri/src/manager.rs | 4 ++-- core/tauri/src/plugin.rs | 8 ++++---- core/tauri/src/scope/ipc.rs | 2 ++ core/tauri/src/window.rs | 6 +++--- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index d7c721b9f12e..1815ee301d4b 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -908,7 +908,7 @@ impl Builder { #[must_use] pub fn invoke_handler(mut self, invoke_handler: F) -> Self where - F: Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static, + F: Fn(Invoke) -> bool + Send + Sync + 'static, { self.invoke_handler = Box::new(invoke_handler); self diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index 3655214aa5a5..f3da5359dcf5 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -25,7 +25,7 @@ pub struct CommandItem<'a, R: Runtime> { pub key: &'static str, /// The [`InvokeMessage`] that was passed to this command. - pub message: &'a InvokeMessage<'a, R>, + pub message: &'a InvokeMessage, } /// Trait implemented by command arguments to derive a value from a [`CommandItem`]. diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index c26724c463db..a09869be4e18 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -28,7 +28,7 @@ pub(crate) mod protocol; pub use channel::Channel; /// A closure that is run every time Tauri receives a message it doesn't explicitly handle. -pub type InvokeHandler = dyn Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static; +pub type InvokeHandler = dyn Fn(Invoke) -> bool + Send + Sync + 'static; /// A closure that is responsible for respond a JS message. pub type InvokeResponder = @@ -152,9 +152,9 @@ impl Response { /// The message and resolver given to a custom command. #[default_runtime(crate::Wry, wry)] -pub struct Invoke<'a, R: Runtime> { +pub struct Invoke { /// The message passed. - pub message: InvokeMessage<'a, R>, + pub message: InvokeMessage, /// The resolver of the message. pub resolver: InvokeResolver, @@ -402,7 +402,7 @@ impl InvokeResolver { /// An invoke message. #[default_runtime(crate::Wry, wry)] #[derive(Debug)] -pub struct InvokeMessage<'a, R: Runtime> { +pub struct InvokeMessage { /// The window that received the invoke message. pub(crate) window: Window, /// Application managed state. @@ -412,29 +412,29 @@ pub struct InvokeMessage<'a, R: Runtime> { /// The JSON argument passed on the invoke message. pub(crate) payload: InvokeBody, /// The request headers. - pub(crate) headers: &'a HeaderMap, + pub(crate) headers: HeaderMap, } -impl<'a, R: Runtime> Clone for InvokeMessage<'a, R> { +impl Clone for InvokeMessage { fn clone(&self) -> Self { Self { window: self.window.clone(), state: self.state.clone(), command: self.command.clone(), payload: self.payload.clone(), - headers: self.headers, + headers: self.headers.clone(), } } } -impl<'a, R: Runtime> InvokeMessage<'a, R> { +impl InvokeMessage { /// Create an new [`InvokeMessage`] from a payload send to a window. pub(crate) fn new( window: Window, state: Arc, command: String, payload: InvokeBody, - headers: &'a HeaderMap, + headers: HeaderMap, ) -> Self { Self { window, diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index f09e0f64905d..53c02e7e40a7 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -130,13 +130,12 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l .unwrap_or_else(|| serde_json::from_str::(&message).map_err(Into::into)) { Ok(message) => { - let headers = Default::default(); let _ = window.on_message(InvokeRequest { cmd: message.cmd, callback: message.callback, error: message.error, body: message.payload.into(), - headers: &headers, + headers: Default::default(), }); } Err(e) => { @@ -227,7 +226,7 @@ fn handle_ipc_request( callback, error, body, - headers: request.headers(), + headers: request.headers().clone(), }; let rx = window.on_message(payload); diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 71d8cf0ca43a..7402f429716c 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -921,7 +921,7 @@ mod test { } impl WindowManager { - pub fn run_invoke_handler(&self, invoke: Invoke<'_, R>) -> bool { + pub fn run_invoke_handler(&self, invoke: Invoke) -> bool { (self.inner.invoke_handler)(invoke) } @@ -935,7 +935,7 @@ impl WindowManager { .on_page_load(window, payload); } - pub fn extend_api(&self, plugin: &str, invoke: Invoke<'_, R>) -> bool { + pub fn extend_api(&self, plugin: &str, invoke: Invoke) -> bool { self .inner .plugins diff --git a/core/tauri/src/plugin.rs b/core/tauri/src/plugin.rs index 81453eca856f..226d488f7a5f 100644 --- a/core/tauri/src/plugin.rs +++ b/core/tauri/src/plugin.rs @@ -60,7 +60,7 @@ pub trait Plugin: Send { /// Extend commands to [`crate::Builder::invoke_handler`]. #[allow(unused_variables)] - fn extend_api(&mut self, invoke: Invoke<'_, R>) -> bool { + fn extend_api(&mut self, invoke: Invoke) -> bool { false } } @@ -241,7 +241,7 @@ impl Builder { #[must_use] pub fn invoke_handler(mut self, invoke_handler: F) -> Self where - F: Fn(Invoke<'_, R>) -> bool + Send + Sync + 'static, + F: Fn(Invoke) -> bool + Send + Sync + 'static, { self.invoke_handler = Box::new(invoke_handler); self @@ -494,7 +494,7 @@ impl Plugin for TauriPlugin { (self.on_event)(app, event) } - fn extend_api(&mut self, invoke: Invoke<'_, R>) -> bool { + fn extend_api(&mut self, invoke: Invoke) -> bool { (self.invoke_handler)(invoke) } } @@ -588,7 +588,7 @@ impl PluginStore { /// Runs the plugin `extend_api` hook if it exists. Returns whether the invoke message was handled or not. /// /// The message is not handled when the plugin exists **and** the command does not. - pub(crate) fn extend_api(&mut self, plugin: &str, invoke: Invoke<'_, R>) -> bool { + pub(crate) fn extend_api(&mut self, plugin: &str, invoke: Invoke) -> bool { if let Some(plugin) = self.store.get_mut(plugin) { plugin.extend_api(invoke) } else { diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index 5eeb5736532c..b0eea0bbd172 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -204,6 +204,7 @@ mod tests { callback, error, body: serde_json::Value::Object(payload).into(), + headers: Default::default(), } } @@ -216,6 +217,7 @@ mod tests { callback, error, body: Default::default(), + headers: Default::default(), } } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 317b6a53c2e7..bc647ae24bcf 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -771,7 +771,7 @@ struct JsEventListenerKey { /// The IPC invoke request. #[derive(Debug)] -pub struct InvokeRequest<'a> { +pub struct InvokeRequest { /// The invoke command. pub cmd: String, /// The success callback. @@ -781,7 +781,7 @@ pub struct InvokeRequest<'a> { /// The body of the request. pub body: InvokeBody, /// The request headers. - pub headers: &'a HeaderMap, + pub headers: HeaderMap, } // TODO: expand these docs since this is a pretty important type @@ -1681,7 +1681,7 @@ impl Window { } /// Handles this window receiving an [`InvokeRequest`]. - pub fn on_message(self, request: InvokeRequest<'_>) -> Receiver { + pub fn on_message(self, request: InvokeRequest) -> Receiver { let manager = self.manager.clone(); let current_url = self.url(); let is_local = self.is_local_url(¤t_url); From dc5e6d8610e0e14078efd1a34966207f12a38ad1 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 19:12:47 -0300 Subject: [PATCH 57/90] send options on ipc.postMessage --- core/tauri/scripts/ipc-protocol.js | 2 +- core/tauri/src/ipc/protocol.rs | 37 ++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 21fc4d48ede1..cc396a58fc83 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -44,7 +44,7 @@ }) } else { // otherwise use the postMessage interface - const { data } = processIpcMessage({ cmd, callback, error, ...payload }) + const { data } = processIpcMessage({ cmd, callback, error, options, ...payload }) window.ipc.postMessage(data) } } diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 53c02e7e40a7..62920e8b377f 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -87,13 +87,46 @@ pub fn get(manager: WindowManager, label: String) -> UriSchemePro #[cfg(not(ipc_custom_protocol))] fn handle_ipc_message(message: String, manager: &WindowManager, label: &str) { if let Some(window) = manager.get_window(label) { - #[derive(serde::Deserialize)] + use serde::{Deserialize, Deserializer}; + + pub(crate) struct HeaderMap(http::HeaderMap); + + impl<'de> Deserialize<'de> for HeaderMap { + fn deserialize(deserializer: D) -> std::result::Result + where + D: Deserializer<'de>, + { + let map = std::collections::HashMap::::deserialize(deserializer)?; + let mut headers = http::HeaderMap::default(); + for (key, value) in map { + if let (Ok(key), Ok(value)) = ( + http::HeaderName::from_bytes(key.as_bytes()), + http::HeaderValue::from_str(&value), + ) { + headers.insert(key, value); + } else { + return Err(serde::de::Error::custom(format!( + "invalid header `{key}` `{value}`" + ))); + } + } + Ok(Self(headers)) + } + } + + #[derive(Deserialize)] + struct RequestOptions { + headers: HeaderMap, + } + + #[derive(Deserialize)] struct Message { cmd: String, callback: CallbackFn, error: CallbackFn, #[serde(flatten)] payload: serde_json::Value, + options: Option, } #[allow(unused_mut)] @@ -135,7 +168,7 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l callback: message.callback, error: message.error, body: message.payload.into(), - headers: Default::default(), + headers: message.options.map(|o| o.headers.0).unwrap_or_default(), }); } Err(e) => { From f17bb70e3ee9ae2b99f7de14e5d15b56466d6f00 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 19:12:57 -0300 Subject: [PATCH 58/90] fix tests --- core/tauri/src/test/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 627c33573d1d..275699517508 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -47,6 +47,7 @@ //! callback: tauri::ipc::CallbackFn(0), //! error: tauri::ipc::CallbackFn(1), //! body: serde_json::Value::Null.into(), +//! headers: Default::default(), //! }, //! Ok(()) //! ); @@ -210,6 +211,7 @@ pub fn mock_app() -> App { /// callback: tauri::ipc::CallbackFn(0), /// error: tauri::ipc::CallbackFn(1), /// body: serde_json::Value::Null.into(), +/// headers: Default::default(), /// }, /// // the expected response is a success with the "pong" payload /// // we could also use Err("error message") here to ensure the command failed From 75418936ec5f7a0efcf2c97ed1d3caf83205077a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 23 Jun 2023 19:14:07 -0300 Subject: [PATCH 59/90] handle options on isolation pattern --- core/tauri/src/ipc/protocol.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 62920e8b377f..af2846974ba5 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -141,6 +141,7 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l error: CallbackFn, #[serde(flatten)] payload: crate::utils::pattern::isolation::RawIsolationPayload<'a>, + options: Option, } if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { @@ -153,6 +154,7 @@ fn handle_ipc_message(message: String, manager: &WindowManager, l callback: message.callback, error: message.error, payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?, + options: message.options, }) }), ); From 76e0fe69b3ef1390a9e0d8376ce6adb62cc426ef Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 24 Jun 2023 07:59:15 -0300 Subject: [PATCH 60/90] allow channel plugin to be executed on remote domains --- core/tauri/src/ipc/channel.rs | 8 ++++---- core/tauri/src/window.rs | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index 8200d4635e03..dfeee8f848e0 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -14,10 +14,10 @@ use crate::{ use super::{CallbackFn, InvokeBody, InvokeError, IpcResponse, Request, Response}; -pub(crate) const IPC_PAYLOAD_PREFIX: &str = "__CHANNEL__:"; -const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; +pub const IPC_PAYLOAD_PREFIX: &str = "__CHANNEL__:"; +pub const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; // TODO: ideally this const references CHANNEL_PLUGIN_NAME -pub(crate) const FETCH_CHANNEL_DATA_COMMAND: &str = "plugin:__TAURI_CHANNEL__|fetch"; +pub const FETCH_CHANNEL_DATA_COMMAND: &str = "plugin:__TAURI_CHANNEL__|fetch"; #[derive(Default, Clone)] pub struct ChannelDataCache(pub(crate) Arc>>); @@ -72,7 +72,7 @@ impl Channel { .unwrap() .insert(data_id, body); window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ 'Tauri-Channel-Id': {data_id} }} }}).then(window['_' + {}])", + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ 'Tauri-Channel-Id': {data_id} }} }}).then(window['_' + {}]).catch(console.error)", callback.0 )) }) diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index bc647ae24bcf..248ea39beaa4 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1805,17 +1805,6 @@ impl Window { if !is_local && scope.is_none() { invoke.resolver.reject(scope_not_found_error_message); } else if request.cmd.starts_with("plugin:") { - if !is_local { - let command = invoke.message.command.replace("plugin:", ""); - let plugin_name = command.split('|').next().unwrap().to_string(); - if !scope - .map(|s| s.plugins().contains(&plugin_name)) - .unwrap_or(true) - { - invoke.resolver.reject(IPC_SCOPE_DOES_NOT_ALLOW); - return rx; - } - } let command = invoke.message.command.replace("plugin:", ""); let mut tokens = command.split('|'); // safe to unwrap: split always has a least one item @@ -1825,6 +1814,16 @@ impl Window { .map(|c| c.to_string()) .unwrap_or_else(String::new); + if !(is_local + || plugin == crate::ipc::channel::CHANNEL_PLUGIN_NAME + || scope + .map(|s| s.plugins().contains(&plugin.into())) + .unwrap_or(true)) + { + invoke.resolver.reject(IPC_SCOPE_DOES_NOT_ALLOW); + return rx; + } + let command = invoke.message.command.clone(); #[cfg(mobile)] From f66766748d576f02bd3f259fa3a29da722c01352 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 24 Jun 2023 07:59:43 -0300 Subject: [PATCH 61/90] delete unused script --- core/tauri/scripts/hotkey.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 core/tauri/scripts/hotkey.js diff --git a/core/tauri/scripts/hotkey.js b/core/tauri/scripts/hotkey.js deleted file mode 100644 index 0bf6f6d73649..000000000000 --- a/core/tauri/scripts/hotkey.js +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -/*! hotkeys-js v3.8.7 | MIT (c) 2021 kenny wong | http://jaywcjlove.github.io/hotkeys */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0 Date: Sat, 24 Jun 2023 08:01:14 -0300 Subject: [PATCH 62/90] header --- core/tauri/src/ipc/channel.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index dfeee8f848e0..aa19b0aacdaa 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -1,3 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + use std::{ collections::HashMap, sync::{Arc, Mutex}, From 2242aa238fd3e8af16dc90222f1d060f83cd8d44 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 24 Jun 2023 08:01:21 -0300 Subject: [PATCH 63/90] format --- tooling/api/src/tauri.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index a83ba561c220..229861357f67 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -127,7 +127,9 @@ type InvokeArgs = Record | number[] | ArrayBuffer | Uint8Array /** * @since 2.0.0 */ -interface InvokeOptions { headers: Headers | Record } +interface InvokeOptions { + headers: Headers | Record +} /** * Sends a message to the backend. @@ -144,7 +146,11 @@ interface InvokeOptions { headers: Headers | Record } * * @since 1.0.0 */ -async function invoke(cmd: string, args: InvokeArgs = {}, options?: InvokeOptions): Promise { +async function invoke( + cmd: string, + args: InvokeArgs = {}, + options?: InvokeOptions +): Promise { return new Promise((resolve, reject) => { const callback = transformCallback((e: T) => { resolve(e) From f4c8f2fc79bea0d794db669aa433882939bae85b Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 24 Jun 2023 09:58:31 -0300 Subject: [PATCH 64/90] move ipc to connect-src CSP --- .../tauri/test/fixture/src-tauri/tauri.conf.json | 4 ++-- examples/api/dist/assets/index.js | 2 +- examples/api/src-tauri/tauri.conf.json | 3 ++- examples/commands/tauri.conf.json | 12 ++++++++---- examples/helloworld/tauri.conf.json | 12 ++++++++---- examples/isolation/tauri.conf.json | 4 ++-- examples/multiwindow/tauri.conf.json | 12 ++++++++---- examples/navigation/tauri.conf.json | 4 ++-- examples/parent-window/tauri.conf.json | 12 ++++++++---- examples/resources/src-tauri/tauri.conf.json | 16 +++++++++++----- examples/splashscreen/tauri.conf.json | 4 ++-- examples/state/tauri.conf.json | 12 ++++++++---- .../tauri-dynamic-lib/src-tauri/tauri.conf.json | 12 ++++++++---- .../cpu_intensive/src-tauri/tauri.conf.json | 4 ++-- .../files_transfer/src-tauri/tauri.conf.json | 4 ++-- .../tests/helloworld/src-tauri/tauri.conf.json | 4 ++-- .../vanilla/src-tauri/tauri.conf.json | 4 ++-- 17 files changed, 78 insertions(+), 47 deletions(-) diff --git a/core/tauri/test/fixture/src-tauri/tauri.conf.json b/core/tauri/test/fixture/src-tauri/tauri.conf.json index 16b11b249e1f..5bf484808dc5 100644 --- a/core/tauri/test/fixture/src-tauri/tauri.conf.json +++ b/core/tauri/test/fixture/src-tauri/tauri.conf.json @@ -15,7 +15,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: ipc: 'unsafe-eval' 'unsafe-inline' 'self'" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" } } -} +} \ No newline at end of file diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 7b6e30d6ecc7..87ac201b919b 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,6 +1,6 @@ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const p of a.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:p,after_update:s}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);p?p.push(...u):V(u),e.$$.on_mount=[]}),s.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(s){if(he(e,s)&&(e=s,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:p}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);console.log(e,n),window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
`,c(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(s){const u=document.querySelector("video"),d=s.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=s,u.srcObject=s}function p(s){if(s.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else s.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${s.name}`,s)}return xe(async()=>{try{const s=await navigator.mediaDevices.getUserMedia(r);a(s)}catch(s){p(s)}}),at(()=>{window.stream.getTracks().forEach(function(s){s.stop()})}),e.$$set=s=>{"onMessage"in s&&n(0,i=s.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode `),n=f("div"),c(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode `),n=f("div"),c(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",p,s,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),p=Q(a),c(n,"class",e[28].icon+" mr-2"),c(t,"href","##"),c(t,"class",s="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,p),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&s!==(s="nv "+(e[1]===e[28]?"nv_selected":""))&&c(t,"class",s)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,p,s,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,m,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(l,T){return l[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(l,T){return l[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let l=0;l Date: Sat, 24 Jun 2023 10:00:15 -0300 Subject: [PATCH 65/90] rebuild example --- examples/api/dist/assets/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 87ac201b919b..7b6e30d6ecc7 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,6 +1,6 @@ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const p of a.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:p,after_update:s}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);p?p.push(...u):V(u),e.$$.on_mount=[]}),s.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(s){if(he(e,s)&&(e=s,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:p}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);console.log(e,n),window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
`,c(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(s){const u=document.querySelector("video"),d=s.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=s,u.srcObject=s}function p(s){if(s.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else s.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${s.name}`,s)}return xe(async()=>{try{const s=await navigator.mediaDevices.getUserMedia(r);a(s)}catch(s){p(s)}}),at(()=>{window.stream.getTracks().forEach(function(s){s.stop()})}),e.$$set=s=>{"onMessage"in s&&n(0,i=s.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode `),n=f("div"),c(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode `),n=f("div"),c(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",p,s,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),p=Q(a),c(n,"class",e[28].icon+" mr-2"),c(t,"href","##"),c(t,"class",s="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,p),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&s!==(s="nv "+(e[1]===e[28]?"nv_selected":""))&&c(t,"class",s)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,p,s,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,m,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(l,T){return l[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(l,T){return l[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let l=0;l Date: Sat, 24 Jun 2023 10:29:33 -0300 Subject: [PATCH 66/90] feat(cli): update config migration script to add `ipc:` to CSP --- .changes/migrate-csp.md | 6 ++ tooling/cli/src/migrate/config.rs | 166 ++++++++++++++++++++++++++++-- 2 files changed, 165 insertions(+), 7 deletions(-) create mode 100644 .changes/migrate-csp.md diff --git a/.changes/migrate-csp.md b/.changes/migrate-csp.md new file mode 100644 index 000000000000..551c7c8473d2 --- /dev/null +++ b/.changes/migrate-csp.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:enhance +"@tauri-apps/cli": patch:enhance +--- + +Update migrate command to update the configuration CSP to include `ipc:` on the `connect-src` directive, needed by the new IPC using custom protocols. diff --git a/tooling/cli/src/migrate/config.rs b/tooling/cli/src/migrate/config.rs index 7312359212ea..452784c2f20b 100644 --- a/tooling/cli/src/migrate/config.rs +++ b/tooling/cli/src/migrate/config.rs @@ -47,6 +47,13 @@ fn migrate_config(config: &mut Value) -> Result<()> { process_allowlist(tauri_config, &mut plugins, allowlist)?; } + if let Some(security) = tauri_config + .get_mut("security") + .and_then(|c| c.as_object_mut()) + { + process_security(security)?; + } + // cli if let Some(cli) = tauri_config.remove("cli") { process_cli(&mut plugins, cli)?; @@ -64,6 +71,42 @@ fn migrate_config(config: &mut Value) -> Result<()> { Ok(()) } +fn process_security(security: &mut Map) -> Result<()> { + // migrate CSP: add `ipc:` to `connect-src` + if let Some(csp_value) = security.remove("csp") { + let csp = if csp_value.is_null() { + csp_value + } else { + let mut csp: tauri_utils_v1::config::Csp = serde_json::from_value(csp_value)?; + match &mut csp { + tauri_utils_v1::config::Csp::Policy(csp) => { + if csp.contains("connect-src") { + *csp = csp.replace("connect-src", "connect-src ipc:"); + } else { + *csp = format!("{csp}; connect-src ipc:"); + } + } + tauri_utils_v1::config::Csp::DirectiveMap(csp) => { + if let Some(connect_src) = csp.get_mut("connect-src") { + if !connect_src.contains("ipc:") { + connect_src.push("ipc:"); + } + } else { + csp.insert( + "connect-src".into(), + tauri_utils_v1::config::CspDirectiveSources::List(vec!["ipc:".to_string()]), + ); + } + } + } + serde_json::to_value(csp)? + }; + + security.insert("csp".into(), csp); + } + Ok(()) +} + fn process_allowlist( tauri_config: &mut Map, plugins: &mut Map, @@ -142,8 +185,19 @@ fn process_updater( #[cfg(test)] mod test { + fn migrate(original: &serde_json::Value) -> serde_json::Value { + let mut migrated = original.clone(); + super::migrate_config(&mut migrated).expect("failed to migrate config"); + + if let Err(e) = serde_json::from_value::(migrated.clone()) { + panic!("migrated config is not valid: {e}"); + } + + migrated + } + #[test] - fn migrate() { + fn migrate_full() { let original = serde_json::json!({ "tauri": { "bundle": { @@ -199,16 +253,14 @@ mod test { "http": { "scope": ["http://localhost:3003/"] } + }, + "security": { + "csp": "default-src: 'self' tauri:" } } }); - let mut migrated = original.clone(); - super::migrate_config(&mut migrated).expect("failed to migrate config"); - - if let Err(e) = serde_json::from_value::(migrated.clone()) { - panic!("migrated config is not valid: {e}"); - } + let migrated = migrate(&original); // bundle > updater assert_eq!( @@ -268,5 +320,105 @@ mod test { migrated["tauri"]["security"]["assetProtocol"]["scope"], original["tauri"]["allowlist"]["protocol"]["assetScope"] ); + + // security CSP + assert_eq!( + migrated["tauri"]["security"]["csp"], + format!( + "{}; connect-src ipc:", + original["tauri"]["security"]["csp"].as_str().unwrap() + ) + ); + } + + #[test] + fn migrate_csp_object() { + let original = serde_json::json!({ + "tauri": { + "security": { + "csp": { + "default-src": ["self", "tauri:"] + } + } + } + }); + + let migrated = migrate(&original); + + assert_eq!( + migrated["tauri"]["security"]["csp"]["default-src"], + original["tauri"]["security"]["csp"]["default-src"] + ); + assert!(migrated["tauri"]["security"]["csp"]["connect-src"] + .as_array() + .expect("connect-src isn't an array") + .contains(&"ipc:".into())); + } + + #[test] + fn migrate_csp_existing_connect_src_string() { + let original = serde_json::json!({ + "tauri": { + "security": { + "csp": { + "default-src": ["self", "tauri:"], + "connect-src": "self" + } + } + } + }); + + let migrated = migrate(&original); + + assert_eq!( + migrated["tauri"]["security"]["csp"]["default-src"], + original["tauri"]["security"]["csp"]["default-src"] + ); + assert_eq!( + migrated["tauri"]["security"]["csp"]["connect-src"] + .as_str() + .expect("connect-src isn't a string"), + format!( + "{} ipc:", + original["tauri"]["security"]["csp"]["connect-src"] + .as_str() + .unwrap() + ) + ); + } + + #[test] + fn migrate_csp_existing_connect_src_array() { + let original = serde_json::json!({ + "tauri": { + "security": { + "csp": { + "default-src": ["self", "tauri:"], + "connect-src": ["self", "asset:"] + } + } + } + }); + + let migrated = migrate(&original); + + assert_eq!( + migrated["tauri"]["security"]["csp"]["default-src"], + original["tauri"]["security"]["csp"]["default-src"] + ); + + let migrated_connect_src = migrated["tauri"]["security"]["csp"]["connect-src"] + .as_array() + .expect("connect-src isn't an array"); + let original_connect_src = original["tauri"]["security"]["csp"]["connect-src"] + .as_array() + .unwrap(); + assert!( + migrated_connect_src + .iter() + .zip(original_connect_src.iter()) + .all(|(a, b)| a == b), + "connect-src migration failed" + ); } } From c909987207d27aba67b41a37e556383c699aa11a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 27 Jun 2023 08:16:25 -0300 Subject: [PATCH 67/90] do not use navigator.userAgent on convertFileSrc --- core/tauri/scripts/bundle.global.js | 2 +- core/tauri/scripts/core.js | 4 +++- core/tauri/src/manager.rs | 12 +++++++++++- examples/api/dist/assets/index.js | 10 +++++----- tooling/api/docs/js-api.json | 2 +- tooling/api/src/index.ts | 16 ++++++++++++++++ tooling/api/src/path.ts | 11 ----------- tooling/api/src/tauri.ts | 14 +------------- 8 files changed, 38 insertions(+), 33 deletions(-) diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 286dd7c56e43..0b77e7b79105 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var i in e)m(n,i,{get:e[i],enumerable:!0})},N=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!W.call(n,a)&&a!==i&&m(n,a,{get:()=>e[a],enumerable:!(o=C(e,a))||o.enumerable});return n};var k=n=>N(m({},"__esModule",{value:!0}),n);var D=(n,e,i)=>{if(!e.has(n))throw TypeError("Cannot "+i)};var _=(n,e,i)=>(D(n,e,"read from private field"),i?i.call(n):e.get(n)),w=(n,e,i)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,i)},A=(n,e,i,o)=>(D(n,e,"write to private field"),o?o.call(n,i):e.set(n,i),i);var vn={};l(vn,{event:()=>f,invoke:()=>hn,path:()=>h,tauri:()=>y});var f={};l(f,{TauriEvent:()=>b,emit:()=>x,listen:()=>R,once:()=>F});var y={};l(y,{Channel:()=>p,PluginListener:()=>d,addPluginListener:()=>L,convertFileSrc:()=>U,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,e=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(e&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,p=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;w(this,c,()=>{});this.id=u(e=>{_(this,c).call(this,e)})}set onmessage(e){A(this,c,e)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var d=class{constructor(e,i,o){this.plugin=e,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,e,i){let o=new p;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:e,handler:o}).then(()=>new d(n,e,o.id))}async function t(n,e={},i){return new Promise((o,a)=>{let v=u(g=>{o(g),Reflect.deleteProperty(window,`_${P}`)},!0),P=u(g=>{a(g),Reflect.deleteProperty(window,`_${v}`)},!0);window.__TAURI_IPC__({cmd:n,callback:v,error:P,payload:e,options:i})})}function U(n,e="asset"){let i=encodeURIComponent(n);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${e}.localhost/${i}`:`${e}://localhost/${i}`}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function I(n,e){await t("plugin:event|unlisten",{event:n,eventId:e})}async function R(n,e,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(e)}).then(o=>async()=>I(n,o))}async function F(n,e,i){return R(n,o=>{e(o),I(n,o.id).catch(()=>{})},i)}async function x(n,e,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:e})}var h={};l(h,{BaseDirectory:()=>O,appCacheDir:()=>V,appConfigDir:()=>$,appDataDir:()=>H,appLocalDataDir:()=>S,appLogDir:()=>an,audioDir:()=>M,basename:()=>yn,cacheDir:()=>j,configDir:()=>z,dataDir:()=>G,delimiter:()=>ln,desktopDir:()=>q,dirname:()=>mn,documentDir:()=>J,downloadDir:()=>K,executableDir:()=>Q,extname:()=>_n,fontDir:()=>Y,homeDir:()=>Z,isAbsolute:()=>fn,join:()=>gn,localDataDir:()=>X,normalize:()=>dn,pictureDir:()=>B,publicDir:()=>nn,resolve:()=>pn,resolveResource:()=>rn,resourceDir:()=>en,runtimeDir:()=>tn,sep:()=>un,tempDir:()=>cn,templateDir:()=>on,videoDir:()=>sn});var O=(r=>(r[r.Audio=1]="Audio",r[r.Cache=2]="Cache",r[r.Config=3]="Config",r[r.Data=4]="Data",r[r.LocalData=5]="LocalData",r[r.Document=6]="Document",r[r.Download=7]="Download",r[r.Picture=8]="Picture",r[r.Public=9]="Public",r[r.Video=10]="Video",r[r.Resource=11]="Resource",r[r.Temp=12]="Temp",r[r.AppConfig=13]="AppConfig",r[r.AppData=14]="AppData",r[r.AppLocalData=15]="AppLocalData",r[r.AppCache=16]="AppCache",r[r.AppLog=17]="AppLog",r[r.Desktop=18]="Desktop",r[r.Executable=19]="Executable",r[r.Font=20]="Font",r[r.Home=21]="Home",r[r.Runtime=22]="Runtime",r[r.Template=23]="Template",r))(O||{});async function $(){return t("plugin:path|resolve_directory",{directory:13})}async function H(){return t("plugin:path|resolve_directory",{directory:14})}async function S(){return t("plugin:path|resolve_directory",{directory:15})}async function V(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function j(){return t("plugin:path|resolve_directory",{directory:2})}async function z(){return t("plugin:path|resolve_directory",{directory:3})}async function G(){return t("plugin:path|resolve_directory",{directory:4})}async function q(){return t("plugin:path|resolve_directory",{directory:18})}async function J(){return t("plugin:path|resolve_directory",{directory:6})}async function K(){return t("plugin:path|resolve_directory",{directory:7})}async function Q(){return t("plugin:path|resolve_directory",{directory:19})}async function Y(){return t("plugin:path|resolve_directory",{directory:20})}async function Z(){return t("plugin:path|resolve_directory",{directory:21})}async function X(){return t("plugin:path|resolve_directory",{directory:5})}async function B(){return t("plugin:path|resolve_directory",{directory:8})}async function nn(){return t("plugin:path|resolve_directory",{directory:9})}async function en(){return t("plugin:path|resolve_directory",{directory:11})}async function rn(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function tn(){return t("plugin:path|resolve_directory",{directory:22})}async function on(){return t("plugin:path|resolve_directory",{directory:23})}async function sn(){return t("plugin:path|resolve_directory",{directory:10})}async function an(){return t("plugin:path|resolve_directory",{directory:17})}async function cn(n){return t("plugin:path|resolve_directory",{directory:12})}function un(){return window.__TAURI__.path.__sep}function ln(){return window.__TAURI__.path.__delimiter}async function pn(...n){return t("plugin:path|resolve",{paths:n})}async function dn(n){return t("plugin:path|normalize",{path:n})}async function gn(...n){return t("plugin:path|join",{paths:n})}async function mn(n){return t("plugin:path|dirname",{path:n})}async function _n(n){return t("plugin:path|extname",{path:n})}async function yn(n,e){return t("plugin:path|basename",{path:n,ext:e})}async function fn(n){return t("plugin:path|isAbsolute",{path:n})}var hn=t;return k(vn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var i in r)m(n,i,{get:r[i],enumerable:!0})},W=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!N.call(n,a)&&a!==i&&m(n,a,{get:()=>r[a],enumerable:!(o=C(r,a))||o.enumerable});return n};var T=n=>W(m({},"__esModule",{value:!0}),n);var D=(n,r,i)=>{if(!r.has(n))throw TypeError("Cannot "+i)};var _=(n,r,i)=>(D(n,r,"read from private field"),i?i.call(n):r.get(n)),w=(n,r,i)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,i)},A=(n,r,i,o)=>(D(n,r,"write to private field"),o?o.call(n,i):r.set(n,i),i);var vn={};p(vn,{event:()=>f,invoke:()=>hn,path:()=>h,tauri:()=>y});var f={};p(f,{TauriEvent:()=>b,emit:()=>x,listen:()=>R,once:()=>F});var y={};p(y,{Channel:()=>l,PluginListener:()=>g,addPluginListener:()=>L,convertFileSrc:()=>U,invoke:()=>t,transformCallback:()=>u});function k(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,r=!1){let i=k(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(r&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,l=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;w(this,c,()=>{});this.id=u(r=>{_(this,c).call(this,r)})}set onmessage(r){A(this,c,r)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var g=class{constructor(r,i,o){this.plugin=r,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,r,i){let o=new l;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:r,handler:o}).then(()=>new g(n,r,o.id))}async function t(n,r={},i){return new Promise((o,a)=>{let v=u(d=>{o(d),Reflect.deleteProperty(window,`_${P}`)},!0),P=u(d=>{a(d),Reflect.deleteProperty(window,`_${v}`)},!0);window.__TAURI_IPC__({cmd:n,callback:v,error:P,payload:r,options:i})})}function U(n,r="asset"){return window.__TAURI__.convertFileSrc(n,r)}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function I(n,r){await t("plugin:event|unlisten",{event:n,eventId:r})}async function R(n,r,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(r)}).then(o=>async()=>I(n,o))}async function F(n,r,i){return R(n,o=>{r(o),I(n,o.id).catch(()=>{})},i)}async function x(n,r,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:r})}var h={};p(h,{BaseDirectory:()=>O,appCacheDir:()=>V,appConfigDir:()=>S,appDataDir:()=>H,appLocalDataDir:()=>$,appLogDir:()=>an,audioDir:()=>M,basename:()=>yn,cacheDir:()=>j,configDir:()=>z,dataDir:()=>G,delimiter:()=>pn,desktopDir:()=>q,dirname:()=>mn,documentDir:()=>J,downloadDir:()=>K,executableDir:()=>Q,extname:()=>_n,fontDir:()=>Y,homeDir:()=>Z,isAbsolute:()=>fn,join:()=>dn,localDataDir:()=>X,normalize:()=>gn,pictureDir:()=>B,publicDir:()=>nn,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>rn,runtimeDir:()=>tn,sep:()=>un,tempDir:()=>cn,templateDir:()=>on,videoDir:()=>sn});var O=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template",e))(O||{});async function S(){return t("plugin:path|resolve_directory",{directory:13})}async function H(){return t("plugin:path|resolve_directory",{directory:14})}async function $(){return t("plugin:path|resolve_directory",{directory:15})}async function V(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function j(){return t("plugin:path|resolve_directory",{directory:2})}async function z(){return t("plugin:path|resolve_directory",{directory:3})}async function G(){return t("plugin:path|resolve_directory",{directory:4})}async function q(){return t("plugin:path|resolve_directory",{directory:18})}async function J(){return t("plugin:path|resolve_directory",{directory:6})}async function K(){return t("plugin:path|resolve_directory",{directory:7})}async function Q(){return t("plugin:path|resolve_directory",{directory:19})}async function Y(){return t("plugin:path|resolve_directory",{directory:20})}async function Z(){return t("plugin:path|resolve_directory",{directory:21})}async function X(){return t("plugin:path|resolve_directory",{directory:5})}async function B(){return t("plugin:path|resolve_directory",{directory:8})}async function nn(){return t("plugin:path|resolve_directory",{directory:9})}async function rn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function tn(){return t("plugin:path|resolve_directory",{directory:22})}async function on(){return t("plugin:path|resolve_directory",{directory:23})}async function sn(){return t("plugin:path|resolve_directory",{directory:10})}async function an(){return t("plugin:path|resolve_directory",{directory:17})}async function cn(n){return t("plugin:path|resolve_directory",{directory:12})}function un(){return window.__TAURI__.path.__sep}function pn(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function gn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function mn(n){return t("plugin:path|dirname",{path:n})}async function _n(n){return t("plugin:path|extname",{path:n})}async function yn(n,r){return t("plugin:path|basename",{path:n,ext:r})}async function fn(n){return t("plugin:path|isAbsolute",{path:n})}var hn=t;return T(vn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 044a2f4bf5d1..6c33e0a0b64b 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -13,9 +13,11 @@ }) } + const osName = __TEMPLATE_os_name__ + window.__TAURI__.convertFileSrc = function convertFileSrc(filePath, protocol = 'asset') { const path = encodeURIComponent(filePath) - return navigator.userAgent.includes('Windows') || navigator.userAgent.includes('Android') + return osName === 'windows' || osName === 'android' ? `https://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}` } diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 7402f429716c..182a1194d4f9 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -823,6 +823,12 @@ impl WindowManager { freeze_prototype: &'a str, } + #[derive(Template)] + #[default_template("../scripts/core.js")] + struct CoreJavascript<'a> { + os_name: &'a str, + } + let bundle_script = if with_global_tauri { include_str!("../scripts/bundle.global.js") } else { @@ -849,7 +855,11 @@ impl WindowManager { "window['_' + window.__TAURI__.transformCallback(cb) ]".into() ) ), - core_script: include_str!("../scripts/core.js"), + core_script: &CoreJavascript { + os_name: std::env::consts::OS, + } + .render_default(&Default::default())? + .into_string(), event_initialization_script: &self.event_initialization_script(), plugin_initialization_script, freeze_prototype, diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index 7b6e30d6ecc7..b7c96e9f0849 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,9 +1,9 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const p of a.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:p,after_update:s}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);p?p.push(...u):V(u),e.$$.on_mount=[]}),s.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(s){if(he(e,s)&&(e=s,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:p}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const p of a.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function c(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:p,after_update:s}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);p?p.push(...u):V(u),e.$$.on_mount=[]}),s.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(s){if(he(e,s)&&(e=s,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:p}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={},n){return new Promise((i,r)=>{let a=fe(s=>{i(s),Reflect.deleteProperty(window,`_${p}`)},!0),p=fe(s=>{r(s),Reflect.deleteProperty(window,`_${a}`)},!0);window.__TAURI_IPC__({cmd:e,callback:a,error:p,payload:t,options:n})})}function Ut(e,t="asset"){return window.__TAURI__.convertFileSrc(e,t)}var Ft={};dt(Ft,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>zt});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function zt(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,p,s,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),p=f("button"),p.textContent="Send event to Rust",c(n,"class","btn"),c(n,"id","log"),c(r,"class","btn"),c(r,"id","request"),c(p,"class","btn"),c(p,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,p),s||(u=[z(n,"click",e[0]),z(r,"click",e[1]),z(p,"click",e[2])],s=!0)},p:$,i:$,o:$,d(d){d&&w(t),s=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function p(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function s(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,p,s,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
`,c(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(s){const u=document.querySelector("video"),d=s.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=s,u.srcObject=s}function p(s){if(s.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else s.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${s.name}`,s)}return xe(async()=>{try{const s=await navigator.mediaDevices.getUserMedia(r);a(s)}catch(s){p(s)}}),at(()=>{window.stream.getTracks().forEach(function(s){s.stop()})}),e.$$set=s=>{"onMessage"in s&&n(0,i=s.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),c(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode `),n=f("div"),c(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode - `),n=f("div"),c(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",p,s,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),p=Q(a),c(n,"class",e[28].icon+" mr-2"),c(t,"href","##"),c(t,"class",s="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,p),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&s!==(s="nv "+(e[1]===e[28]?"nv_selected":""))&&c(t,"class",s)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,p,s,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,m,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(l,T){return l[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(l,T){return l[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let l=0;l`,me=g(),b=f("a"),b.innerHTML=`GitHub - `,j=g(),C=f("a"),C.innerHTML=`Source - `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),m=g(),_=f("div");for(let l=0;l',ze=g(),oe=f("div");for(let l=0;l{Re(h,1)}),Dt()}Y?(y=new Y(Ge(l)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=l[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,m=>n(4,i=m));function v(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof m=="string"?m:JSON.stringify(m,null,1))+"
"},..._])}function S(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+m+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(m){I=m.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const D=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",D)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",D)}let b=!1,j,C,q=!1,B=0,ee=0;const te=(m,_,D)=>Math.min(Math.max(_,m),D);xe(()=>{n(13,j=document.querySelector("#sidebar")),C=document.querySelector("#sidebarToggle"),document.addEventListener("click",m=>{C.contains(m.target)?n(0,b=!b):b&&!j.contains(m.target)&&n(0,b=!1)}),document.addEventListener("touchstart",m=>{if(C.contains(m.target))return;const _=m.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",m=>{if(q){const _=m.touches[0].clientX;ee=_;const D=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-D:18.75-D,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const m=(ee-B)/10;n(0,b=b?m>-(18.75/2):m>18.75/2)}q=!1})});const pe=m=>{s(m),n(0,b=!1)};function ge(m){Ne[m?"unshift":"push"](()=>{O=m,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const m=document.querySelector("#sidebar");m&&rn(m,b)}},[b,p,u,O,i,a,s,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); + `,j=g(),D=f("a"),D.innerHTML=`Source + `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),m=g(),_=f("div");for(let l=0;l',Fe=g(),oe=f("div");for(let l=0;l{Re(h,1)}),Ct()}Y?(y=new Y(Ge(l)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=l[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,m=>n(4,i=m));function v(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof m=="string"?m:JSON.stringify(m,null,1))+"
"},..._])}function S(m){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+m+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(m){I=m.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const C=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",C)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",C)}let b=!1,j,D,q=!1,B=0,ee=0;const te=(m,_,C)=>Math.min(Math.max(_,m),C);xe(()=>{n(13,j=document.querySelector("#sidebar")),D=document.querySelector("#sidebarToggle"),document.addEventListener("click",m=>{D.contains(m.target)?n(0,b=!b):b&&!j.contains(m.target)&&n(0,b=!1)}),document.addEventListener("touchstart",m=>{if(D.contains(m.target))return;const _=m.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",m=>{if(q){const _=m.touches[0].clientX;ee=_;const C=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-C:18.75-C,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const m=(ee-B)/10;n(0,b=b?m>-(18.75/2):m>18.75/2)}q=!1})});const pe=m=>{s(m),n(0,b=!1)};function ge(m){Ne[m?"unshift":"push"](()=>{O=m,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const m=document.querySelector("#sidebar");m&&rn(m,b)}},[b,p,u,O,i,a,s,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index e102fa5368f3..c568342cce14 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":119,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L119"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":119,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L119"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":68,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L68"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":68,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L68"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":85,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L85"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":85,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":102,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L102"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":102,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L102"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":531,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L531"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":531,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L531"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L141"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L141"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":664,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L664"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":664,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L664"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":163,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L163"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":163,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L163"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":185,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L185"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":185,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L185"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":207,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L207"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":207,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L207"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":571,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L571"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":571,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L571"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":229,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L229"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":229,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L229"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":630,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L630"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":630,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L630"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":251,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L251"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":251,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L251"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":273,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L273"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":273,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L273"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":295,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L295"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":295,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L295"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":646,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L646"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":646,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L646"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":317,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L317"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":317,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L317"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":339,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L339"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":339,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L339"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":678,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L678"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":678,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L678"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":615,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L615"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":615,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L615"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":361,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L361"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":361,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L361"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":600,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L600"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":600,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L600"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":383,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L383"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":383,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L383"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":405,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L405"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":405,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L405"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":585,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L585"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":585,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L585"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":442,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L442"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":442,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L442"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":422,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L422"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":422,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L422"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":465,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L465"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":465,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L465"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L560"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":547,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L547"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":547,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L547"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":487,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L487"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":487,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L487"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":509,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L509"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":509,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L509"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L63"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":63,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L63"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":59,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L59"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":58,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L58"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L56"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"},{"fileName":"tauri.ts","line":73,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":73,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L73"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L69"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":55,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L55"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L87"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":87,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L87"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":84,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L84"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":83,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L83"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L93"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L93"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":82,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L82"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":125,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L125"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L108"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L108"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L111"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":111,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L111"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":223,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":198,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L198"}],"signatures":[{"id":224,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":198,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L198"}],"parameters":[{"id":225,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":226,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":147,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L147"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":147,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L147"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":222,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":33,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L33"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":33,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L33"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L34"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":34,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L34"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,223,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/f4c2c5658/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L108"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L108"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":57,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L57"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":57,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L57"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":74,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L74"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":74,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L74"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":91,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L91"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":91,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L91"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":520,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L520"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":520,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L520"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":130,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L130"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":130,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L130"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":653,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L653"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":653,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L653"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":152,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L152"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":152,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L152"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":174,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L174"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":174,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L174"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":196,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L196"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L196"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L560"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":218,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L218"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":218,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L218"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":619,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L619"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":619,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L619"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":240,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L240"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":240,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L240"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":262,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L262"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":262,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L262"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":284,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L284"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":284,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L284"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":635,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L635"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":635,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L635"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":306,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L306"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":306,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L306"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":328,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L328"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":328,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L328"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":667,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L667"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":667,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L667"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":604,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L604"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":604,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L604"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":350,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L350"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":350,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L350"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":589,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L589"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":589,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L589"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":372,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L372"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":372,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L372"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":394,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L394"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":394,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L394"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":574,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L574"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":574,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L574"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":431,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L431"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":431,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L431"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":411,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L411"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":411,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L411"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":454,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L454"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":454,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L454"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":549,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L549"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":549,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L549"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":536,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L536"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":536,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L536"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":476,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L476"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":476,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L476"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":498,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L498"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":498,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L498"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L55"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L55"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":50,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L50"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L48"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"},{"fileName":"tauri.ts","line":65,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L69"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":47,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L47"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L79"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L79"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L76"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":75,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L75"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L85"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":74,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L74"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":117,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L117"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":100,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L100"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":100,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L100"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L103"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L103"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":223,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":196,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L196"}],"signatures":[{"id":224,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L196"}],"parameters":[{"id":225,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":226,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":222,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":25,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L25"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":25,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L25"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L26"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L26"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,223,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/index.ts b/tooling/api/src/index.ts index 658c39ed82e6..84d483b58c87 100644 --- a/tooling/api/src/index.ts +++ b/tooling/api/src/index.ts @@ -17,6 +17,22 @@ import * as event from './event' import * as tauri from './tauri' import * as path from './path' +/** @ignore */ +declare global { + interface Window { + __TAURI__: { + path: { + __sep: string + __delimiter: string + } + + convertFileSrc: (src: string, protocol: string) => string + } + + __TAURI_IPC__: (message: any) => void + } +} + /** @ignore */ const invoke = tauri.invoke diff --git a/tooling/api/src/path.ts b/tooling/api/src/path.ts index 93d0b468639b..e87f0480188f 100644 --- a/tooling/api/src/path.ts +++ b/tooling/api/src/path.ts @@ -43,17 +43,6 @@ enum BaseDirectory { Template } -declare global { - interface Window { - __TAURI__: { - path: { - __sep: string - __delimiter: string - } - } - } -} - /** * Returns the path to the suggested directory for your app's config files. * Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value [`tauri.bundle.identifier`](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in `tauri.conf.json`. diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 229861357f67..d671a06a6dbd 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -9,14 +9,6 @@ * @module */ -/** @ignore */ -declare global { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - interface Window { - __TAURI_IPC__: (message: any) => void - } -} - /** @ignore */ function uid(): number { return window.crypto.getRandomValues(new Uint32Array(1))[0] @@ -202,11 +194,7 @@ async function invoke( * @since 1.0.0 */ function convertFileSrc(filePath: string, protocol = 'asset'): string { - const path = encodeURIComponent(filePath) - return navigator.userAgent.includes('Windows') || - navigator.userAgent.includes('Android') - ? `https://${protocol}.localhost/${path}` - : `${protocol}://localhost/${path}` + return window.__TAURI__.convertFileSrc(filePath, protocol) } export type { InvokeArgs } From 60ae63b58b77148dbe9e77bd1da81e6703bfebcf Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 11 Jul 2023 14:04:35 -0300 Subject: [PATCH 68/90] fix warning [skip ci] --- core/tauri/scripts/bundle.global.js | 2 +- tooling/api/docs/js-api.json | 2 +- tooling/api/src/tauri.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tauri/scripts/bundle.global.js b/core/tauri/scripts/bundle.global.js index 0b77e7b79105..299376ccf66e 100644 --- a/core/tauri/scripts/bundle.global.js +++ b/core/tauri/scripts/bundle.global.js @@ -1,2 +1,2 @@ -"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var i in r)m(n,i,{get:r[i],enumerable:!0})},W=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!N.call(n,a)&&a!==i&&m(n,a,{get:()=>r[a],enumerable:!(o=C(r,a))||o.enumerable});return n};var T=n=>W(m({},"__esModule",{value:!0}),n);var D=(n,r,i)=>{if(!r.has(n))throw TypeError("Cannot "+i)};var _=(n,r,i)=>(D(n,r,"read from private field"),i?i.call(n):r.get(n)),w=(n,r,i)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,i)},A=(n,r,i,o)=>(D(n,r,"write to private field"),o?o.call(n,i):r.set(n,i),i);var vn={};p(vn,{event:()=>f,invoke:()=>hn,path:()=>h,tauri:()=>y});var f={};p(f,{TauriEvent:()=>b,emit:()=>x,listen:()=>R,once:()=>F});var y={};p(y,{Channel:()=>l,PluginListener:()=>g,addPluginListener:()=>L,convertFileSrc:()=>U,invoke:()=>t,transformCallback:()=>u});function k(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,r=!1){let i=k(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(r&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,l=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;w(this,c,()=>{});this.id=u(r=>{_(this,c).call(this,r)})}set onmessage(r){A(this,c,r)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var g=class{constructor(r,i,o){this.plugin=r,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,r,i){let o=new l;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:r,handler:o}).then(()=>new g(n,r,o.id))}async function t(n,r={},i){return new Promise((o,a)=>{let v=u(d=>{o(d),Reflect.deleteProperty(window,`_${P}`)},!0),P=u(d=>{a(d),Reflect.deleteProperty(window,`_${v}`)},!0);window.__TAURI_IPC__({cmd:n,callback:v,error:P,payload:r,options:i})})}function U(n,r="asset"){return window.__TAURI__.convertFileSrc(n,r)}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function I(n,r){await t("plugin:event|unlisten",{event:n,eventId:r})}async function R(n,r,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(r)}).then(o=>async()=>I(n,o))}async function F(n,r,i){return R(n,o=>{r(o),I(n,o.id).catch(()=>{})},i)}async function x(n,r,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:r})}var h={};p(h,{BaseDirectory:()=>O,appCacheDir:()=>V,appConfigDir:()=>S,appDataDir:()=>H,appLocalDataDir:()=>$,appLogDir:()=>an,audioDir:()=>M,basename:()=>yn,cacheDir:()=>j,configDir:()=>z,dataDir:()=>G,delimiter:()=>pn,desktopDir:()=>q,dirname:()=>mn,documentDir:()=>J,downloadDir:()=>K,executableDir:()=>Q,extname:()=>_n,fontDir:()=>Y,homeDir:()=>Z,isAbsolute:()=>fn,join:()=>dn,localDataDir:()=>X,normalize:()=>gn,pictureDir:()=>B,publicDir:()=>nn,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>rn,runtimeDir:()=>tn,sep:()=>un,tempDir:()=>cn,templateDir:()=>on,videoDir:()=>sn});var O=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template",e))(O||{});async function S(){return t("plugin:path|resolve_directory",{directory:13})}async function H(){return t("plugin:path|resolve_directory",{directory:14})}async function $(){return t("plugin:path|resolve_directory",{directory:15})}async function V(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function j(){return t("plugin:path|resolve_directory",{directory:2})}async function z(){return t("plugin:path|resolve_directory",{directory:3})}async function G(){return t("plugin:path|resolve_directory",{directory:4})}async function q(){return t("plugin:path|resolve_directory",{directory:18})}async function J(){return t("plugin:path|resolve_directory",{directory:6})}async function K(){return t("plugin:path|resolve_directory",{directory:7})}async function Q(){return t("plugin:path|resolve_directory",{directory:19})}async function Y(){return t("plugin:path|resolve_directory",{directory:20})}async function Z(){return t("plugin:path|resolve_directory",{directory:21})}async function X(){return t("plugin:path|resolve_directory",{directory:5})}async function B(){return t("plugin:path|resolve_directory",{directory:8})}async function nn(){return t("plugin:path|resolve_directory",{directory:9})}async function rn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function tn(){return t("plugin:path|resolve_directory",{directory:22})}async function on(){return t("plugin:path|resolve_directory",{directory:23})}async function sn(){return t("plugin:path|resolve_directory",{directory:10})}async function an(){return t("plugin:path|resolve_directory",{directory:17})}async function cn(n){return t("plugin:path|resolve_directory",{directory:12})}function un(){return window.__TAURI__.path.__sep}function pn(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function gn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function mn(n){return t("plugin:path|dirname",{path:n})}async function _n(n){return t("plugin:path|extname",{path:n})}async function yn(n,r){return t("plugin:path|basename",{path:n,ext:r})}async function fn(n){return t("plugin:path|isAbsolute",{path:n})}var hn=t;return T(vn);})(); +"use strict";var __TAURI_IIFE__=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var i in r)m(n,i,{get:r[i],enumerable:!0})},W=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!N.call(n,a)&&a!==i&&m(n,a,{get:()=>r[a],enumerable:!(o=C(r,a))||o.enumerable});return n};var k=n=>W(m({},"__esModule",{value:!0}),n);var D=(n,r,i)=>{if(!r.has(n))throw TypeError("Cannot "+i)};var _=(n,r,i)=>(D(n,r,"read from private field"),i?i.call(n):r.get(n)),w=(n,r,i)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,i)},A=(n,r,i,o)=>(D(n,r,"write to private field"),o?o.call(n,i):r.set(n,i),i);var vn={};p(vn,{event:()=>f,invoke:()=>hn,path:()=>h,tauri:()=>y});var f={};p(f,{TauriEvent:()=>b,emit:()=>x,listen:()=>R,once:()=>F});var y={};p(y,{Channel:()=>l,PluginListener:()=>g,addPluginListener:()=>L,convertFileSrc:()=>U,invoke:()=>t,transformCallback:()=>u});function T(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function u(n,r=!1){let i=T(),o=`_${i}`;return Object.defineProperty(window,o,{value:a=>(r&&Reflect.deleteProperty(window,o),n?.(a)),writable:!1,configurable:!0}),i}var c,l=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;w(this,c,()=>{});this.id=u(r=>{_(this,c).call(this,r)})}set onmessage(r){A(this,c,r)}get onmessage(){return _(this,c)}toJSON(){return`__CHANNEL__:${this.id}`}};c=new WeakMap;var g=class{constructor(r,i,o){this.plugin=r,this.event=i,this.channelId=o}async unregister(){return t(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function L(n,r,i){let o=new l;return o.onmessage=i,t(`plugin:${n}|register_listener`,{event:r,handler:o}).then(()=>new g(n,r,o.id))}async function t(n,r={},i){return new Promise((o,a)=>{let v=u(d=>{o(d),Reflect.deleteProperty(window,`_${P}`)},!0),P=u(d=>{a(d),Reflect.deleteProperty(window,`_${v}`)},!0);window.__TAURI_IPC__({cmd:n,callback:v,error:P,payload:r,options:i})})}function U(n,r="asset"){return window.__TAURI__.convertFileSrc(n,r)}var b=(s=>(s.WINDOW_RESIZED="tauri://resize",s.WINDOW_MOVED="tauri://move",s.WINDOW_CLOSE_REQUESTED="tauri://close-requested",s.WINDOW_CREATED="tauri://window-created",s.WINDOW_DESTROYED="tauri://destroyed",s.WINDOW_FOCUS="tauri://focus",s.WINDOW_BLUR="tauri://blur",s.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",s.WINDOW_THEME_CHANGED="tauri://theme-changed",s.WINDOW_FILE_DROP="tauri://file-drop",s.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",s.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",s.MENU="tauri://menu",s))(b||{});async function I(n,r){await t("plugin:event|unlisten",{event:n,eventId:r})}async function R(n,r,i){return t("plugin:event|listen",{event:n,windowLabel:i?.target,handler:u(r)}).then(o=>async()=>I(n,o))}async function F(n,r,i){return R(n,o=>{r(o),I(n,o.id).catch(()=>{})},i)}async function x(n,r,i){await t("plugin:event|emit",{event:n,windowLabel:i?.target,payload:r})}var h={};p(h,{BaseDirectory:()=>O,appCacheDir:()=>V,appConfigDir:()=>S,appDataDir:()=>H,appLocalDataDir:()=>$,appLogDir:()=>an,audioDir:()=>M,basename:()=>yn,cacheDir:()=>j,configDir:()=>z,dataDir:()=>G,delimiter:()=>pn,desktopDir:()=>q,dirname:()=>mn,documentDir:()=>J,downloadDir:()=>K,executableDir:()=>Q,extname:()=>_n,fontDir:()=>Y,homeDir:()=>Z,isAbsolute:()=>fn,join:()=>dn,localDataDir:()=>X,normalize:()=>gn,pictureDir:()=>B,publicDir:()=>nn,resolve:()=>ln,resolveResource:()=>en,resourceDir:()=>rn,runtimeDir:()=>tn,sep:()=>un,tempDir:()=>cn,templateDir:()=>on,videoDir:()=>sn});var O=(e=>(e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template",e))(O||{});async function S(){return t("plugin:path|resolve_directory",{directory:13})}async function H(){return t("plugin:path|resolve_directory",{directory:14})}async function $(){return t("plugin:path|resolve_directory",{directory:15})}async function V(){return t("plugin:path|resolve_directory",{directory:16})}async function M(){return t("plugin:path|resolve_directory",{directory:1})}async function j(){return t("plugin:path|resolve_directory",{directory:2})}async function z(){return t("plugin:path|resolve_directory",{directory:3})}async function G(){return t("plugin:path|resolve_directory",{directory:4})}async function q(){return t("plugin:path|resolve_directory",{directory:18})}async function J(){return t("plugin:path|resolve_directory",{directory:6})}async function K(){return t("plugin:path|resolve_directory",{directory:7})}async function Q(){return t("plugin:path|resolve_directory",{directory:19})}async function Y(){return t("plugin:path|resolve_directory",{directory:20})}async function Z(){return t("plugin:path|resolve_directory",{directory:21})}async function X(){return t("plugin:path|resolve_directory",{directory:5})}async function B(){return t("plugin:path|resolve_directory",{directory:8})}async function nn(){return t("plugin:path|resolve_directory",{directory:9})}async function rn(){return t("plugin:path|resolve_directory",{directory:11})}async function en(n){return t("plugin:path|resolve_directory",{directory:11,path:n})}async function tn(){return t("plugin:path|resolve_directory",{directory:22})}async function on(){return t("plugin:path|resolve_directory",{directory:23})}async function sn(){return t("plugin:path|resolve_directory",{directory:10})}async function an(){return t("plugin:path|resolve_directory",{directory:17})}async function cn(n){return t("plugin:path|resolve_directory",{directory:12})}function un(){return window.__TAURI__.path.__sep}function pn(){return window.__TAURI__.path.__delimiter}async function ln(...n){return t("plugin:path|resolve",{paths:n})}async function gn(n){return t("plugin:path|normalize",{path:n})}async function dn(...n){return t("plugin:path|join",{paths:n})}async function mn(n){return t("plugin:path|dirname",{path:n})}async function _n(n){return t("plugin:path|extname",{path:n})}async function yn(n,r){return t("plugin:path|basename",{path:n,ext:r})}async function fn(n){return t("plugin:path|isAbsolute",{path:n})}var hn=t;return k(vn);})(); window.__TAURI__ = __TAURI_IIFE__ diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index c568342cce14..436415cf8a6d 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L108"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L108"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":57,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L57"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":57,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L57"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":74,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L74"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":74,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L74"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":91,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L91"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":91,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L91"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":520,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L520"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":520,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L520"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":130,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L130"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":130,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L130"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":653,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L653"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":653,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L653"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":152,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L152"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":152,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L152"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":174,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L174"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":174,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L174"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":196,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L196"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L196"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L560"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":218,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L218"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":218,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L218"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":619,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L619"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":619,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L619"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":240,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L240"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":240,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L240"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":262,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L262"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":262,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L262"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":284,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L284"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":284,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L284"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":635,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L635"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":635,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L635"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":306,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L306"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":306,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L306"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":328,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L328"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":328,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L328"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":667,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L667"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":667,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L667"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":604,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L604"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":604,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L604"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":350,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L350"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":350,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L350"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":589,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L589"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":589,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L589"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":372,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L372"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":372,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L372"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":394,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L394"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":394,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L394"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":574,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L574"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":574,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L574"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":431,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L431"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":431,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L431"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":411,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L411"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":411,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L411"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":454,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L454"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":454,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L454"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":549,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L549"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":549,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L549"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":536,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L536"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":536,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L536"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":476,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L476"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":476,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L476"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":498,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L498"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":498,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L498"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":174,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":175,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L55"}],"signatures":[{"id":176,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L55"}],"typeParameter":[{"id":177,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":174,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":180,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"type":{"type":"reflection","declaration":{"id":181,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"signatures":[{"id":182,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L51"}],"parameters":[{"id":183,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":179,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":50,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L50"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":178,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L48"}],"type":{"type":"intrinsic","name":"number"}},{"id":184,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"},{"fileName":"tauri.ts","line":65,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"getSignature":{"id":185,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"type":{"type":"reflection","declaration":{"id":186,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"signatures":[{"id":187,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L65"}],"parameters":[{"id":188,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":189,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":190,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":191,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"signatures":[{"id":192,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":193,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":194,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":195,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L69"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[175]},{"title":"Properties","children":[180,179,178]},{"title":"Accessors","children":[184]},{"title":"Methods","children":[194]}],"sources":[{"fileName":"tauri.ts","line":47,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L47"}],"typeParameters":[{"id":196,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":197,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":198,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L79"}],"signatures":[{"id":199,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L79"}],"parameters":[{"id":200,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":201,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":202,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":205,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"number"}},{"id":204,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L76"}],"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":75,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L75"}],"type":{"type":"intrinsic","name":"string"}},{"id":206,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L85"}],"signatures":[{"id":207,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[198]},{"title":"Properties","children":[205,204,203]},{"title":"Methods","children":[206]}],"sources":[{"fileName":"tauri.ts","line":74,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L74"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":117,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L117"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":208,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":100,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L100"}],"signatures":[{"id":209,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":100,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L100"}],"typeParameter":[{"id":210,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":211,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":212,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":213,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":214,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L103"}],"signatures":[{"id":215,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L103"}],"parameters":[{"id":216,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":197,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":223,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":196,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L196"}],"signatures":[{"id":224,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L196"}],"parameters":[{"id":225,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":226,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":217,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":218,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":219,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":220,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":221,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":222,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":167,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":25,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L25"}],"signatures":[{"id":168,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":25,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L25"}],"parameters":[{"id":169,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":170,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L26"}],"signatures":[{"id":171,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L26"}],"parameters":[{"id":172,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":173,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[174,197]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[208,223,217,167]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/cb05f57cd/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L108"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L108"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":57,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L57"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":57,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L57"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":74,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L74"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":74,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L74"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":91,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L91"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":91,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L91"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":520,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L520"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":520,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L520"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":130,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L130"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":130,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L130"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":653,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L653"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":653,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L653"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":152,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L152"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":152,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L152"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":174,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L174"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":174,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L174"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":196,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L196"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L196"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L560"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":218,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L218"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":218,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L218"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":619,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L619"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":619,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L619"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":240,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L240"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":240,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L240"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":262,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L262"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":262,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L262"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":284,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L284"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":284,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L284"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":635,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L635"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":635,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L635"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":306,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L306"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":306,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L306"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":328,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L328"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":328,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L328"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":667,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L667"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":667,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L667"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":604,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L604"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":604,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L604"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":350,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L350"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":350,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L350"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":589,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L589"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":589,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L589"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":372,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L372"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":372,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L372"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":394,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L394"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":394,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L394"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":574,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L574"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":574,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L574"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":431,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L431"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":431,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L431"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":411,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L411"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":411,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L411"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":454,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L454"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":454,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L454"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":549,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L549"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":549,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L549"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":536,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L536"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":536,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L536"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":476,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L476"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":476,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L476"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":498,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L498"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":498,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L498"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":176,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":177,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L55"}],"signatures":[{"id":178,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L55"}],"typeParameter":[{"id":179,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":176,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":182,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"type":{"type":"reflection","declaration":{"id":183,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"signatures":[{"id":184,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"parameters":[{"id":185,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":181,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":50,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L50"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":180,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L48"}],"type":{"type":"intrinsic","name":"number"}},{"id":186,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"},{"fileName":"tauri.ts","line":65,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"getSignature":{"id":187,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"type":{"type":"reflection","declaration":{"id":188,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"signatures":[{"id":189,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"parameters":[{"id":190,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":191,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":192,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":193,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"signatures":[{"id":194,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":195,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":196,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":197,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L69"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[177]},{"title":"Properties","children":[182,181,180]},{"title":"Accessors","children":[186]},{"title":"Methods","children":[196]}],"sources":[{"fileName":"tauri.ts","line":47,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L47"}],"typeParameters":[{"id":198,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":199,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":200,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L79"}],"signatures":[{"id":201,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L79"}],"parameters":[{"id":202,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":204,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":207,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"number"}},{"id":206,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L76"}],"type":{"type":"intrinsic","name":"string"}},{"id":205,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":75,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L75"}],"type":{"type":"intrinsic","name":"string"}},{"id":208,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L85"}],"signatures":[{"id":209,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[200]},{"title":"Properties","children":[207,206,205]},{"title":"Methods","children":[208]}],"sources":[{"fileName":"tauri.ts","line":74,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L74"}]},{"id":167,"name":"InvokeOptions","variant":"declaration","kind":256,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":168,"name":"headers","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":123,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L123"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"string"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.dom.d.ts","qualifiedName":"Headers"},"name":"Headers","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/API/Headers"}]}}],"groups":[{"title":"Properties","children":[168]}],"sources":[{"fileName":"tauri.ts","line":122,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L122"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":117,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L117"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":210,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":100,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L100"}],"signatures":[{"id":211,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":100,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L100"}],"typeParameter":[{"id":212,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":213,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":214,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":215,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":216,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L103"}],"signatures":[{"id":217,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L103"}],"parameters":[{"id":218,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":225,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":196,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L196"}],"signatures":[{"id":226,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L196"}],"parameters":[{"id":227,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":228,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":219,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":220,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":221,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":222,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":223,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":224,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":167,"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":169,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":25,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L25"}],"signatures":[{"id":170,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":25,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L25"}],"parameters":[{"id":171,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":172,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L26"}],"signatures":[{"id":173,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L26"}],"parameters":[{"id":174,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":175,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[176,199]},{"title":"Interfaces","children":[167]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[210,225,219,169]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions.headers"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"227":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"228":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index d671a06a6dbd..f1b6d01ef9c6 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -197,7 +197,7 @@ function convertFileSrc(filePath: string, protocol = 'asset'): string { return window.__TAURI__.convertFileSrc(filePath, protocol) } -export type { InvokeArgs } +export type { InvokeArgs, InvokeOptions } export { transformCallback, From 2bddd93d1bc6c155864b581dd7ea0cc230b0520e Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 11 Jul 2023 14:16:23 -0300 Subject: [PATCH 69/90] move declare global --- tooling/api/docs/js-api.json | 2 +- tooling/api/src/index.ts | 16 ---------------- tooling/api/src/tauri.ts | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tooling/api/docs/js-api.json b/tooling/api/docs/js-api.json index 436415cf8a6d..75b7bf593198 100644 --- a/tooling/api/docs/js-api.json +++ b/tooling/api/docs/js-api.json @@ -1 +1 @@ -{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L108"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L108"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":57,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L57"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":57,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L57"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":74,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L74"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":74,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L74"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":91,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L91"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":91,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L91"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":520,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L520"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":520,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L520"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":130,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L130"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":130,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L130"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":653,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L653"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":653,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L653"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":152,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L152"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":152,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L152"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":174,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L174"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":174,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L174"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":196,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L196"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L196"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L560"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":218,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L218"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":218,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L218"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":619,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L619"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":619,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L619"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":240,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L240"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":240,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L240"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":262,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L262"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":262,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L262"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":284,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L284"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":284,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L284"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":635,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L635"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":635,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L635"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":306,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L306"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":306,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L306"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":328,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L328"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":328,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L328"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":667,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L667"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":667,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L667"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":604,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L604"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":604,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L604"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":350,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L350"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":350,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L350"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":589,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L589"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":589,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L589"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":372,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L372"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":372,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L372"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":394,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L394"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":394,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L394"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":574,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L574"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":574,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L574"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":431,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L431"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":431,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L431"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":411,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L411"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":411,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L411"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":454,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L454"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":454,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L454"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":549,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L549"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":549,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L549"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":536,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L536"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":536,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L536"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":476,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L476"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":476,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L476"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":498,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L498"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":498,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L498"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":176,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":177,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L55"}],"signatures":[{"id":178,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L55"}],"typeParameter":[{"id":179,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":176,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":182,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"type":{"type":"reflection","declaration":{"id":183,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"signatures":[{"id":184,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":51,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L51"}],"parameters":[{"id":185,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":181,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":50,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L50"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":180,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L48"}],"type":{"type":"intrinsic","name":"number"}},{"id":186,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"},{"fileName":"tauri.ts","line":65,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"getSignature":{"id":187,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"type":{"type":"reflection","declaration":{"id":188,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"signatures":[{"id":189,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":65,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L65"}],"parameters":[{"id":190,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":191,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":192,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":193,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"signatures":[{"id":194,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":61,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L61"}],"parameters":[{"id":195,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":196,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L69"}],"signatures":[{"id":197,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":69,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L69"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[177]},{"title":"Properties","children":[182,181,180]},{"title":"Accessors","children":[186]},{"title":"Methods","children":[196]}],"sources":[{"fileName":"tauri.ts","line":47,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L47"}],"typeParameters":[{"id":198,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":199,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":200,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L79"}],"signatures":[{"id":201,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":79,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L79"}],"parameters":[{"id":202,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":204,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":207,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L77"}],"type":{"type":"intrinsic","name":"number"}},{"id":206,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":76,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L76"}],"type":{"type":"intrinsic","name":"string"}},{"id":205,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":75,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L75"}],"type":{"type":"intrinsic","name":"string"}},{"id":208,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L85"}],"signatures":[{"id":209,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L85"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[200]},{"title":"Properties","children":[207,206,205]},{"title":"Methods","children":[208]}],"sources":[{"fileName":"tauri.ts","line":74,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L74"}]},{"id":167,"name":"InvokeOptions","variant":"declaration","kind":256,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":168,"name":"headers","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":123,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L123"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"string"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.dom.d.ts","qualifiedName":"Headers"},"name":"Headers","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/API/Headers"}]}}],"groups":[{"title":"Properties","children":[168]}],"sources":[{"fileName":"tauri.ts","line":122,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L122"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":117,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L117"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":210,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":100,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L100"}],"signatures":[{"id":211,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":100,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L100"}],"typeParameter":[{"id":212,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":213,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":214,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":215,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":216,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L103"}],"signatures":[{"id":217,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":103,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L103"}],"parameters":[{"id":218,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":225,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":196,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L196"}],"signatures":[{"id":226,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L196"}],"parameters":[{"id":227,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":228,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":219,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":141,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L141"}],"signatures":[{"id":220,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":141,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L141"}],"typeParameter":[{"id":221,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":222,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":223,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":224,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":167,"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":169,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":25,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L25"}],"signatures":[{"id":170,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":25,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L25"}],"parameters":[{"id":171,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":172,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L26"}],"signatures":[{"id":173,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":26,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L26"}],"parameters":[{"id":174,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":175,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[176,199]},{"title":"Interfaces","children":[167]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[210,225,219,169]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/c90998720/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions.headers"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"227":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"228":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file +{"id":0,"name":"@tauri-apps/api","variant":"project","kind":1,"flags":{},"children":[{"id":1,"name":"event","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The event system allows you to emit events to the backend and listen to events from it.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.event`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":36,"name":"TauriEvent","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.1.0"}]}]},"children":[{"id":49,"name":"MENU","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":59,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L59"}],"type":{"type":"literal","value":"tauri://menu"}},{"id":43,"name":"WINDOW_BLUR","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":53,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L53"}],"type":{"type":"literal","value":"tauri://blur"}},{"id":39,"name":"WINDOW_CLOSE_REQUESTED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":49,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L49"}],"type":{"type":"literal","value":"tauri://close-requested"}},{"id":40,"name":"WINDOW_CREATED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":50,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L50"}],"type":{"type":"literal","value":"tauri://window-created"}},{"id":41,"name":"WINDOW_DESTROYED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":51,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L51"}],"type":{"type":"literal","value":"tauri://destroyed"}},{"id":46,"name":"WINDOW_FILE_DROP","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":56,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L56"}],"type":{"type":"literal","value":"tauri://file-drop"}},{"id":48,"name":"WINDOW_FILE_DROP_CANCELLED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":58,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L58"}],"type":{"type":"literal","value":"tauri://file-drop-cancelled"}},{"id":47,"name":"WINDOW_FILE_DROP_HOVER","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":57,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L57"}],"type":{"type":"literal","value":"tauri://file-drop-hover"}},{"id":42,"name":"WINDOW_FOCUS","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":52,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L52"}],"type":{"type":"literal","value":"tauri://focus"}},{"id":38,"name":"WINDOW_MOVED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":48,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L48"}],"type":{"type":"literal","value":"tauri://move"}},{"id":37,"name":"WINDOW_RESIZED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":47,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L47"}],"type":{"type":"literal","value":"tauri://resize"}},{"id":44,"name":"WINDOW_SCALE_FACTOR_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":54,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L54"}],"type":{"type":"literal","value":"tauri://scale-change"}},{"id":45,"name":"WINDOW_THEME_CHANGED","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"event.ts","line":55,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L55"}],"type":{"type":"literal","value":"tauri://theme-changed"}}],"groups":[{"title":"Enumeration Members","children":[49,43,39,40,41,46,48,47,42,38,37,44,45]}],"sources":[{"fileName":"event.ts","line":46,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L46"}]},{"id":2,"name":"Event","variant":"declaration","kind":256,"flags":{},"children":[{"id":3,"name":"event","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name"}]},"sources":[{"fileName":"event.ts","line":16,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L16"}],"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":5,"name":"id","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event identifier used to unlisten"}]},"sources":[{"fileName":"event.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L20"}],"type":{"type":"intrinsic","name":"number"}},{"id":6,"name":"payload","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event payload"}]},"sources":[{"fileName":"event.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L22"}],"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}},{"id":4,"name":"windowLabel","variant":"declaration","kind":1024,"flags":{},"comment":{"summary":[{"kind":"text","text":"The label of the window that emitted this event."}]},"sources":[{"fileName":"event.ts","line":18,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L18"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[3,5,6,4]}],"sources":[{"fileName":"event.ts","line":14,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L14"}],"typeParameters":[{"id":7,"name":"T","variant":"typeParam","kind":131072,"flags":{}}]},{"id":17,"name":"Options","variant":"declaration","kind":256,"flags":{},"children":[{"id":18,"name":"target","variant":"declaration","kind":1024,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Label of the window the function targets.\n\nWhen listening to events and using this value,\nonly events triggered by the window with the given label are received.\n\nWhen emitting events, only the window with the given label will receive it."}]},"sources":[{"fileName":"event.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L40"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[18]}],"sources":[{"fileName":"event.ts","line":31,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L31"}]},{"id":8,"name":"EventCallback","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L25"}],"typeParameters":[{"id":12,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"type":{"type":"reflection","declaration":{"id":9,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":25,"character":24,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L25"}],"signatures":[{"id":10,"name":"__type","variant":"signature","kind":4096,"flags":{},"parameters":[{"id":11,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":2,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Event","package":"@tauri-apps/api"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":16,"name":"EventName","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":29,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L29"}],"type":{"type":"union","types":[{"type":"templateLiteral","head":"","tail":[[{"type":"reference","target":36,"name":"TauriEvent","package":"@tauri-apps/api"},""]]},{"type":"intersection","types":[{"type":"intrinsic","name":"string"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"never"},{"type":"intrinsic","name":"never"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}]}]}},{"id":13,"name":"UnlistenFn","variant":"declaration","kind":4194304,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L27"}],"type":{"type":"reflection","declaration":{"id":14,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"event.ts","line":27,"character":18,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L27"}],"signatures":[{"id":15,"name":"__type","variant":"signature","kind":4096,"flags":{},"type":{"type":"intrinsic","name":"void"}}]}}},{"id":31,"name":"emit","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":164,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L164"}],"signatures":[{"id":32,"name":"emit","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Emits an event to the backend and all Tauri windows."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { emit } from '@tauri-apps/api/event';\nawait emit('frontend-loaded', { loggedIn: true, token: 'authToken' });\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":164,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L164"}],"parameters":[{"id":33,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"string"}},{"id":34,"name":"payload","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"intrinsic","name":"unknown"}},{"id":35,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":19,"name":"listen","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":99,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L99"}],"signatures":[{"id":20,"name":"listen","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an event. The event can be either global or window-specific.\nSee "},{"kind":"inline-tag","tag":"@link","text":"windowLabel","target":4,"tsLinkText":""},{"kind":"text","text":" to check the event source."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { listen } from '@tauri-apps/api/event';\nconst unlisten = await listen('error', (event) => {\n console.log(`Got error in window ${event.windowLabel}, payload: ${event.payload}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":99,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L99"}],"typeParameter":[{"id":21,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":22,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":23,"name":"handler","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event handler callback."}]},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":24,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":25,"name":"once","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"event.ts","line":137,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L137"}],"signatures":[{"id":26,"name":"once","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Listen to an one-off event. See "},{"kind":"inline-tag","tag":"@link","text":"listen","target":19,"tsLinkText":""},{"kind":"text","text":" for more information."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { once } from '@tauri-apps/api/event';\ninterface LoadedPayload {\n loggedIn: boolean,\n token: string\n}\nconst unlisten = await once('loaded', (event) => {\n console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`);\n});\n\n// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted\nunlisten();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving to a function to unlisten to the event.\nNote that removing the listener is required if your listener goes out of scope e.g. the component is unmounted."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"event.ts","line":137,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L137"}],"typeParameter":[{"id":27,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":28,"name":"event","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Event name. Must include only alphanumeric characters, "},{"kind":"code","text":"`-`"},{"kind":"text","text":", "},{"kind":"code","text":"`/`"},{"kind":"text","text":", "},{"kind":"code","text":"`:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`_`"},{"kind":"text","text":"."}]},"type":{"type":"reference","target":16,"name":"EventName","package":"@tauri-apps/api"}},{"id":29,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":8,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"EventCallback","package":"@tauri-apps/api"}},{"id":30,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reference","target":17,"name":"Options","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":13,"name":"UnlistenFn","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[36]},{"title":"Interfaces","children":[2,17]},{"title":"Type Aliases","children":[8,16,13]},{"title":"Functions","children":[31,19,25]}],"sources":[{"fileName":"event.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/event.ts#L1"}]},{"id":50,"name":"mocks","variant":"declaration","kind":2,"flags":{},"children":[{"id":62,"name":"clearMocks","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":178,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L178"}],"signatures":[{"id":63,"name":"clearMocks","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Clears mocked functions/data injected by the other functions in this module.\nWhen using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.\n\n# Example\n\n"},{"kind":"code","text":"```js\nimport { mockWindows, clearMocks } from \"@tauri-apps/api/mocks\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked windows\", () => {\n mockWindows(\"main\", \"second\", \"third\");\n\n expect(window).toHaveProperty(\"__TAURI_METADATA__\")\n})\n\ntest(\"no mocked windows\", () => {\n expect(window).not.toHaveProperty(\"__TAURI_METADATA__\")\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":178,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L178"}],"type":{"type":"intrinsic","name":"void"}}]},{"id":51,"name":"mockIPC","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":80,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L80"}],"signatures":[{"id":52,"name":"mockIPC","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Intercepts all IPC requests with the given mock handler.\n\nThis function can be used when testing tauri frontend applications or when running the frontend in a Node.js context during static site generation.\n\n# Examples\n\nTesting setup using vitest:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n switch (cmd) {\n case \"add\":\n return (payload.a as number) + (payload.b as number);\n default:\n break;\n }\n });\n\n expect(invoke('add', { a: 12, b: 15 })).resolves.toBe(27);\n})\n```"},{"kind":"text","text":"\n\nThe callback function can also return a Promise:\n"},{"kind":"code","text":"```js\nimport { mockIPC, clearMocks } from \"@tauri-apps/api/mocks\"\nimport { invoke } from \"@tauri-apps/api/tauri\"\n\nafterEach(() => {\n clearMocks()\n})\n\ntest(\"mocked command\", () => {\n mockIPC((cmd, payload) => {\n if(cmd === \"get_data\") {\n return fetch(\"https://example.com/data.json\")\n .then((response) => response.json())\n }\n });\n\n expect(invoke('get_data')).resolves.toBe({ foo: 'bar' });\n})\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":80,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L80"}],"parameters":[{"id":53,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":54,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L81"}],"signatures":[{"id":55,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"mocks.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L81"}],"parameters":[{"id":56,"name":"cmd","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":58,"name":"mockWindows","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"mocks.ts","line":142,"character":16,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L142"}],"signatures":[{"id":59,"name":"mockWindows","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Mocks one or many window labels.\nIn non-tauri context it is required to call this function *before* using the "},{"kind":"code","text":"`@tauri-apps/api/window`"},{"kind":"text","text":" module.\n\nThis function only mocks the *presence* of windows,\nwindow properties (e.g. width and height) can be mocked like regular IPC calls using the "},{"kind":"code","text":"`mockIPC`"},{"kind":"text","text":" function.\n\n# Examples\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nconst win = getCurrent();\n\nwin.label // \"main\"\n```"},{"kind":"text","text":"\n\n"},{"kind":"code","text":"```js\nimport { mockWindows } from \"@tauri-apps/api/mocks\";\n\nmockWindows(\"main\", \"second\", \"third\");\n\nmockIPC((cmd, args) => {\n if (cmd === \"plugin:event|emit\") {\n console.log('emit event', args?.event, args?.payload);\n }\n});\n\nconst { emit } = await import(\"@tauri-apps/api/event\");\nawait emit('loaded'); // this will cause the mocked IPC handler to log to the console.\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"mocks.ts","line":142,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L142"}],"parameters":[{"id":60,"name":"current","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"Label of window this JavaScript context is running in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"additionalWindows","variant":"param","kind":32768,"flags":{"isRest":true},"comment":{"summary":[{"kind":"text","text":"Label of additional windows the app has."}]},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Functions","children":[62,51,58]}],"sources":[{"fileName":"mocks.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/mocks.ts#L1"}]},{"id":64,"name":"path","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path module provides utilities for working with file and directory paths.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.path`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":".\n\nIt is recommended to allowlist only the APIs you use for optimal bundle size and security."}]},"children":[{"id":65,"name":"BaseDirectory","variant":"declaration","kind":8,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":81,"name":"AppCache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":35,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L35"}],"type":{"type":"literal","value":16}},{"id":78,"name":"AppConfig","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":32,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L32"}],"type":{"type":"literal","value":13}},{"id":79,"name":"AppData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":33,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L33"}],"type":{"type":"literal","value":14}},{"id":80,"name":"AppLocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":34,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L34"}],"type":{"type":"literal","value":15}},{"id":82,"name":"AppLog","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":36,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L36"}],"type":{"type":"literal","value":17}},{"id":66,"name":"Audio","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":20,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L20"}],"type":{"type":"literal","value":1}},{"id":67,"name":"Cache","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":21,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L21"}],"type":{"type":"literal","value":2}},{"id":68,"name":"Config","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":22,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L22"}],"type":{"type":"literal","value":3}},{"id":69,"name":"Data","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":23,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L23"}],"type":{"type":"literal","value":4}},{"id":83,"name":"Desktop","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":38,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L38"}],"type":{"type":"literal","value":18}},{"id":71,"name":"Document","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":25,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L25"}],"type":{"type":"literal","value":6}},{"id":72,"name":"Download","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":26,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L26"}],"type":{"type":"literal","value":7}},{"id":84,"name":"Executable","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":39,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L39"}],"type":{"type":"literal","value":19}},{"id":85,"name":"Font","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":40,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L40"}],"type":{"type":"literal","value":20}},{"id":86,"name":"Home","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":41,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L41"}],"type":{"type":"literal","value":21}},{"id":70,"name":"LocalData","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":24,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L24"}],"type":{"type":"literal","value":5}},{"id":73,"name":"Picture","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":27,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L27"}],"type":{"type":"literal","value":8}},{"id":74,"name":"Public","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":28,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L28"}],"type":{"type":"literal","value":9}},{"id":76,"name":"Resource","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":30,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L30"}],"type":{"type":"literal","value":11}},{"id":87,"name":"Runtime","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":42,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L42"}],"type":{"type":"literal","value":22}},{"id":77,"name":"Temp","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":31,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L31"}],"type":{"type":"literal","value":12}},{"id":88,"name":"Template","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":43,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L43"}],"type":{"type":"literal","value":23}},{"id":75,"name":"Video","variant":"declaration","kind":16,"flags":{},"sources":[{"fileName":"path.ts","line":29,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L29"}],"type":{"type":"literal","value":10}}],"groups":[{"title":"Enumeration Members","children":[81,78,79,80,82,66,67,68,69,83,71,72,84,85,86,70,73,74,76,87,77,88,75]}],"sources":[{"fileName":"path.ts","line":19,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L19"}]},{"id":95,"name":"appCacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":108,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L108"}],"signatures":[{"id":96,"name":"appCacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's cache files.\nResolves to "},{"kind":"code","text":"`${cacheDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appCacheDir } from '@tauri-apps/api/path';\nconst appCacheDirPath = await appCacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":108,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L108"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":89,"name":"appConfigDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":57,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L57"}],"signatures":[{"id":90,"name":"appConfigDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's config files.\nResolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appConfigDir } from '@tauri-apps/api/path';\nconst appConfigDirPath = await appConfigDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":57,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L57"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":91,"name":"appDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":74,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L74"}],"signatures":[{"id":92,"name":"appDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's data files.\nResolves to "},{"kind":"code","text":"`${dataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":74,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L74"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":93,"name":"appLocalDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":91,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L91"}],"signatures":[{"id":94,"name":"appLocalDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's local data files.\nResolves to "},{"kind":"code","text":"`${localDataDir}/${bundleIdentifier}`"},{"kind":"text","text":", where "},{"kind":"code","text":"`bundleIdentifier`"},{"kind":"text","text":" is the value ["},{"kind":"code","text":"`tauri.bundle.identifier`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#bundleconfig.identifier) is configured in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLocalDataDir } from '@tauri-apps/api/path';\nconst appLocalDataDirPath = await appLocalDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":91,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L91"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":97,"name":"appLogDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":520,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L520"}],"signatures":[{"id":98,"name":"appLogDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the suggested directory for your app's log files.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`${homeDir}/Library/Logs/{bundleIdentifier}`"},{"kind":"text","text":"\n- **Windows:** Resolves to "},{"kind":"code","text":"`${configDir}/${bundleIdentifier}/logs`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appLogDir } from '@tauri-apps/api/path';\nconst appLogDirPath = await appLogDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.2.0"}]}]},"sources":[{"fileName":"path.ts","line":520,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L520"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":99,"name":"audioDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":130,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L130"}],"signatures":[{"id":100,"name":"audioDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's audio directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_MUSIC_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Music`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Music}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { audioDir } from '@tauri-apps/api/path';\nconst audioDirPath = await audioDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":130,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L130"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":155,"name":"basename","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":653,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L653"}],"signatures":[{"id":156,"name":"basename","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the last portion of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { basename, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst base = await basename(resourcePath);\nassert(base === 'app.conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":653,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L653"}],"parameters":[{"id":157,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":158,"name":"ext","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional file extension to be removed from the returned path."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":101,"name":"cacheDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":152,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L152"}],"signatures":[{"id":102,"name":"cacheDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's cache directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CACHE_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.cache`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Caches`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { cacheDir } from '@tauri-apps/api/path';\nconst cacheDirPath = await cacheDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":152,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L152"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":103,"name":"configDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":174,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L174"}],"signatures":[{"id":104,"name":"configDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's config directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_CONFIG_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.config`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { configDir } from '@tauri-apps/api/path';\nconst configDirPath = await configDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":174,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L174"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":105,"name":"dataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":196,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L196"}],"signatures":[{"id":106,"name":"dataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_RoamingAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dataDir } from '@tauri-apps/api/path';\nconst dataDirPath = await dataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":196,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L196"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":138,"name":"delimiter","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":560,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L560"}],"signatures":[{"id":139,"name":"delimiter","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment delimiter:\n- "},{"kind":"code","text":"`;`"},{"kind":"text","text":" on Windows\n- "},{"kind":"code","text":"`:`"},{"kind":"text","text":" on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":560,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L560"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":107,"name":"desktopDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":218,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L218"}],"signatures":[{"id":108,"name":"desktopDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's desktop directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DESKTOP_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Desktop`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Desktop}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { desktopDir } from '@tauri-apps/api/path';\nconst desktopPath = await desktopDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":218,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L218"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":149,"name":"dirname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":619,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L619"}],"signatures":[{"id":150,"name":"dirname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the directory name of a "},{"kind":"code","text":"`path`"},{"kind":"text","text":". Trailing directory separators are ignored."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { dirname, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst dir = await dirname(appDataDirPath);\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":619,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L619"}],"parameters":[{"id":151,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":109,"name":"documentDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":240,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L240"}],"signatures":[{"id":110,"name":"documentDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's document directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { documentDir } from '@tauri-apps/api/path';\nconst documentDirPath = await documentDir();\n```"},{"kind":"text","text":"\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOCUMENTS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Documents`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Documents}`"},{"kind":"text","text":"."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":240,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L240"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":111,"name":"downloadDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":262,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L262"}],"signatures":[{"id":112,"name":"downloadDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's download directory.\n\n#### Platform-specific\n\n- **Linux**: Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_DOWNLOAD_DIR`"},{"kind":"text","text":".\n- **macOS**: Resolves to "},{"kind":"code","text":"`$HOME/Downloads`"},{"kind":"text","text":".\n- **Windows**: Resolves to "},{"kind":"code","text":"`{FOLDERID_Downloads}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { downloadDir } from '@tauri-apps/api/path';\nconst downloadDirPath = await downloadDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":262,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L262"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":113,"name":"executableDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":284,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L284"}],"signatures":[{"id":114,"name":"executableDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's executable directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_BIN_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$XDG_DATA_HOME/../bin`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/bin`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { executableDir } from '@tauri-apps/api/path';\nconst executableDirPath = await executableDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":284,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L284"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":152,"name":"extname","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":635,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L635"}],"signatures":[{"id":153,"name":"extname","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the extension of the "},{"kind":"code","text":"`path`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { extname, resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('app.conf');\nconst ext = await extname(resourcePath);\nassert(ext === 'conf');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":635,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L635"}],"parameters":[{"id":154,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":115,"name":"fontDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":306,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L306"}],"signatures":[{"id":116,"name":"fontDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's font directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME/fonts`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share/fonts`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Fonts`"},{"kind":"text","text":".\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { fontDir } from '@tauri-apps/api/path';\nconst fontDirPath = await fontDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":306,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L306"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":117,"name":"homeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":328,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L328"}],"signatures":[{"id":118,"name":"homeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's home directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Profile}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { homeDir } from '@tauri-apps/api/path';\nconst homeDirPath = await homeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":328,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L328"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":159,"name":"isAbsolute","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":667,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L667"}],"signatures":[{"id":160,"name":"isAbsolute","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns whether the path is absolute or not."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { isAbsolute } from '@tauri-apps/api/path';\nassert(await isAbsolute('/home/tauri'));\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":667,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L667"}],"parameters":[{"id":161,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":146,"name":"join","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":604,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L604"}],"signatures":[{"id":147,"name":"join","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Joins all given "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments together using the platform-specific separator as a delimiter, then normalizes the resulting path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { join, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":604,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L604"}],"parameters":[{"id":148,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":119,"name":"localDataDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":350,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L350"}],"signatures":[{"id":120,"name":"localDataDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's local data directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_DATA_HOME`"},{"kind":"text","text":" or "},{"kind":"code","text":"`$HOME/.local/share`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Library/Application Support`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_LocalAppData}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { localDataDir } from '@tauri-apps/api/path';\nconst localDataDirPath = await localDataDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":350,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L350"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":143,"name":"normalize","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":589,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L589"}],"signatures":[{"id":144,"name":"normalize","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Normalizes the given "},{"kind":"code","text":"`path`"},{"kind":"text","text":", resolving "},{"kind":"code","text":"`'..'`"},{"kind":"text","text":" and "},{"kind":"code","text":"`'.'`"},{"kind":"text","text":" segments and resolve symbolic links."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { normalize, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await normalize(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":589,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L589"}],"parameters":[{"id":145,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":121,"name":"pictureDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":372,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L372"}],"signatures":[{"id":122,"name":"pictureDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's picture directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PICTURES_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Pictures`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Pictures}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { pictureDir } from '@tauri-apps/api/path';\nconst pictureDirPath = await pictureDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":372,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L372"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":123,"name":"publicDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":394,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L394"}],"signatures":[{"id":124,"name":"publicDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's public directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_PUBLICSHARE_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Public`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Public}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { publicDir } from '@tauri-apps/api/path';\nconst publicDirPath = await publicDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":394,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L394"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":140,"name":"resolve","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":574,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L574"}],"signatures":[{"id":141,"name":"resolve","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolves a sequence of "},{"kind":"code","text":"`paths`"},{"kind":"text","text":" or "},{"kind":"code","text":"`path`"},{"kind":"text","text":" segments into an absolute path."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolve, appDataDir } from '@tauri-apps/api/path';\nconst appDataDirPath = await appDataDir();\nconst path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":574,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L574"}],"parameters":[{"id":142,"name":"paths","variant":"param","kind":32768,"flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":127,"name":"resolveResource","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":431,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L431"}],"signatures":[{"id":128,"name":"resolveResource","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Resolve the path to a resource file."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resolveResource } from '@tauri-apps/api/path';\nconst resourcePath = await resolveResource('script.sh');\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"The full path to the resource."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":431,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L431"}],"parameters":[{"id":129,"name":"resourcePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The path to the resource.\nMust follow the same syntax as defined in "},{"kind":"code","text":"`tauri.conf.json > tauri > bundle > resources`"},{"kind":"text","text":", i.e. keeping subfolders and parent dir components ("},{"kind":"code","text":"`../`"},{"kind":"text","text":")."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":125,"name":"resourceDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":411,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L411"}],"signatures":[{"id":126,"name":"resourceDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the application's resource directory.\nTo resolve a resource path, see the [[resolveResource | "},{"kind":"code","text":"`resolveResource API`"},{"kind":"text","text":"]]."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { resourceDir } from '@tauri-apps/api/path';\nconst resourceDirPath = await resourceDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":411,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L411"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":130,"name":"runtimeDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":454,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L454"}],"signatures":[{"id":131,"name":"runtimeDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's runtime directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to "},{"kind":"code","text":"`$XDG_RUNTIME_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Not supported."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { runtimeDir } from '@tauri-apps/api/path';\nconst runtimeDirPath = await runtimeDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":454,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L454"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":136,"name":"sep","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":549,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L549"}],"signatures":[{"id":137,"name":"sep","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the platform-specific path segment separator:\n- "},{"kind":"code","text":"`\\` on Windows\n- `"},{"kind":"text","text":"/` on POSIX"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":549,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L549"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":162,"name":"tempDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":536,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L536"}],"signatures":[{"id":163,"name":"tempDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a temporary directory."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { tempDir } from '@tauri-apps/api/path';\nconst temp = await tempDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"path.ts","line":536,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L536"}],"parameters":[{"id":164,"name":"path","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":132,"name":"templateDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":476,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L476"}],"signatures":[{"id":133,"name":"templateDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's template directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_TEMPLATES_DIR`"},{"kind":"text","text":".\n- **macOS:** Not supported.\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Templates}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { templateDir } from '@tauri-apps/api/path';\nconst templateDirPath = await templateDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":476,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L476"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":134,"name":"videoDir","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"path.ts","line":498,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L498"}],"signatures":[{"id":135,"name":"videoDir","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the path to the user's video directory.\n\n#### Platform-specific\n\n- **Linux:** Resolves to ["},{"kind":"code","text":"`xdg-user-dirs`"},{"kind":"text","text":"](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/)' "},{"kind":"code","text":"`XDG_VIDEOS_DIR`"},{"kind":"text","text":".\n- **macOS:** Resolves to "},{"kind":"code","text":"`$HOME/Movies`"},{"kind":"text","text":".\n- **Windows:** Resolves to "},{"kind":"code","text":"`{FOLDERID_Videos}`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { videoDir } from '@tauri-apps/api/path';\nconst videoDirPath = await videoDir();\n```"}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"path.ts","line":498,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L498"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Enumerations","children":[65]},{"title":"Functions","children":[95,89,91,93,97,99,155,101,103,105,138,107,149,109,111,113,152,115,117,159,146,119,143,121,123,140,127,125,130,136,162,132,134]}],"sources":[{"fileName":"path.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/path.ts#L1"}]},{"id":165,"name":"tauri","variant":"declaration","kind":2,"flags":{},"comment":{"summary":[{"kind":"text","text":"Invoke your custom commands.\n\nThis package is also accessible with "},{"kind":"code","text":"`window.__TAURI__.tauri`"},{"kind":"text","text":" when ["},{"kind":"code","text":"`build.withGlobalTauri`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":"."}]},"children":[{"id":176,"name":"Channel","variant":"declaration","kind":128,"flags":{},"children":[{"id":177,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":71,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L71"}],"signatures":[{"id":178,"name":"new Channel","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":71,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L71"}],"typeParameter":[{"id":179,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reference","target":176,"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Channel","package":"@tauri-apps/api"}}]},{"id":182,"name":"#onmessage","variant":"declaration","kind":1024,"flags":{"isPrivate":true},"sources":[{"fileName":"tauri.ts","line":67,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L67"}],"type":{"type":"reflection","declaration":{"id":183,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":67,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L67"}],"signatures":[{"id":184,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":67,"character":14,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L67"}],"parameters":[{"id":185,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}},"defaultValue":"..."},{"id":181,"name":"__TAURI_CHANNEL_MARKER__","variant":"declaration","kind":1024,"flags":{"isPrivate":true,"isReadonly":true},"sources":[{"fileName":"tauri.ts","line":66,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L66"}],"type":{"type":"literal","value":true},"defaultValue":"true"},{"id":180,"name":"id","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":64,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L64"}],"type":{"type":"intrinsic","name":"number"}},{"id":186,"name":"onmessage","variant":"declaration","kind":262144,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L77"},{"fileName":"tauri.ts","line":81,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L81"}],"getSignature":{"id":187,"name":"onmessage","variant":"signature","kind":524288,"flags":{},"sources":[{"fileName":"tauri.ts","line":81,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L81"}],"type":{"type":"reflection","declaration":{"id":188,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":81,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L81"}],"signatures":[{"id":189,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":81,"character":19,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L81"}],"parameters":[{"id":190,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}},"setSignature":{"id":191,"name":"onmessage","variant":"signature","kind":1048576,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L77"}],"parameters":[{"id":192,"name":"handler","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":193,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L77"}],"signatures":[{"id":194,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":77,"character":25,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L77"}],"parameters":[{"id":195,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"intrinsic","name":"void"}}},{"id":196,"name":"toJSON","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L85"}],"signatures":[{"id":197,"name":"toJSON","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":85,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L85"}],"type":{"type":"intrinsic","name":"string"}}]}],"groups":[{"title":"Constructors","children":[177]},{"title":"Properties","children":[182,181,180]},{"title":"Accessors","children":[186]},{"title":"Methods","children":[196]}],"sources":[{"fileName":"tauri.ts","line":63,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L63"}],"typeParameters":[{"id":198,"name":"T","variant":"typeParam","kind":131072,"flags":{},"default":{"type":"intrinsic","name":"unknown"}}]},{"id":199,"name":"PluginListener","variant":"declaration","kind":128,"flags":{},"children":[{"id":200,"name":"constructor","variant":"declaration","kind":512,"flags":{},"sources":[{"fileName":"tauri.ts","line":95,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L95"}],"signatures":[{"id":201,"name":"new PluginListener","variant":"signature","kind":16384,"flags":{},"sources":[{"fileName":"tauri.ts","line":95,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L95"}],"parameters":[{"id":202,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":203,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":204,"name":"channelId","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}}]},{"id":207,"name":"channelId","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":93,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L93"}],"type":{"type":"intrinsic","name":"number"}},{"id":206,"name":"event","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":92,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L92"}],"type":{"type":"intrinsic","name":"string"}},{"id":205,"name":"plugin","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":91,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L91"}],"type":{"type":"intrinsic","name":"string"}},{"id":208,"name":"unregister","variant":"declaration","kind":2048,"flags":{},"sources":[{"fileName":"tauri.ts","line":101,"character":8,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L101"}],"signatures":[{"id":209,"name":"unregister","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":101,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L101"}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]}],"groups":[{"title":"Constructors","children":[200]},{"title":"Properties","children":[207,206,205]},{"title":"Methods","children":[208]}],"sources":[{"fileName":"tauri.ts","line":90,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L90"}]},{"id":167,"name":"InvokeOptions","variant":"declaration","kind":256,"flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"children":[{"id":168,"name":"headers","variant":"declaration","kind":1024,"flags":{},"sources":[{"fileName":"tauri.ts","line":139,"character":2,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L139"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"string"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.dom.d.ts","qualifiedName":"Headers"},"name":"Headers","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/API/Headers"}]}}],"groups":[{"title":"Properties","children":[168]}],"sources":[{"fileName":"tauri.ts","line":138,"character":10,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L138"}]},{"id":166,"name":"InvokeArgs","variant":"declaration","kind":4194304,"flags":{},"comment":{"summary":[{"kind":"text","text":"Command arguments."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":133,"character":5,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L133"}],"type":{"type":"union","types":[{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Record"},"typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","package":"typescript","externalUrl":"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type"},{"type":"array","elementType":{"type":"intrinsic","name":"number"}},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"ArrayBuffer"},"name":"ArrayBuffer","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"},{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Uint8Array"},"name":"Uint8Array","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array"}]}},{"id":210,"name":"addPluginListener","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":116,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L116"}],"signatures":[{"id":211,"name":"addPluginListener","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Adds a listener to a plugin event."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The listener object to stop listening to the events."}]},{"tag":"@since","content":[{"kind":"text","text":"2.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":116,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L116"}],"typeParameter":[{"id":212,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":213,"name":"plugin","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":214,"name":"event","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":215,"name":"cb","variant":"param","kind":32768,"flags":{},"type":{"type":"reflection","declaration":{"id":216,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":119,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L119"}],"signatures":[{"id":217,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":119,"character":6,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L119"}],"parameters":[{"id":218,"name":"payload","variant":"param","kind":32768,"flags":{},"type":{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":199,"name":"PluginListener","package":"@tauri-apps/api"}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":225,"name":"convertFileSrc","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":212,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L212"}],"signatures":[{"id":226,"name":"convertFileSrc","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Convert a device file path to an URL that can be loaded by the webview.\nNote that "},{"kind":"code","text":"`asset:`"},{"kind":"text","text":" and "},{"kind":"code","text":"`https://asset.localhost`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.security.csp`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#securityconfig.csp) in "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":".\nExample CSP value: "},{"kind":"code","text":"`\"csp\": \"default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost\"`"},{"kind":"text","text":" to use the asset protocol on image sources.\n\nAdditionally, "},{"kind":"code","text":"`asset`"},{"kind":"text","text":" must be added to ["},{"kind":"code","text":"`tauri.allowlist.protocol`"},{"kind":"text","text":"](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\nin "},{"kind":"code","text":"`tauri.conf.json`"},{"kind":"text","text":" and its access scope must be defined on the "},{"kind":"code","text":"`assetScope`"},{"kind":"text","text":" array on the same "},{"kind":"code","text":"`protocol`"},{"kind":"text","text":" object."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { appDataDir, join } from '@tauri-apps/api/path';\nimport { convertFileSrc } from '@tauri-apps/api/tauri';\nconst appDataDirPath = await appDataDir();\nconst filePath = await join(appDataDirPath, 'assets/video.mp4');\nconst assetUrl = convertFileSrc(filePath);\n\nconst video = document.getElementById('my-video');\nconst source = document.createElement('source');\nsource.type = 'video/mp4';\nsource.src = assetUrl;\nvideo.appendChild(source);\nvideo.load();\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"the URL that can be used as source on the webview."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":212,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L212"}],"parameters":[{"id":227,"name":"filePath","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The file path."}]},"type":{"type":"intrinsic","name":"string"}},{"id":228,"name":"protocol","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The protocol to use. Defaults to "},{"kind":"code","text":"`asset`"},{"kind":"text","text":". You only need to set this when using a custom protocol."}]},"type":{"type":"intrinsic","name":"string"},"defaultValue":"'asset'"}],"type":{"type":"intrinsic","name":"string"}}]},{"id":219,"name":"invoke","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":157,"character":15,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L157"}],"signatures":[{"id":220,"name":"invoke","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Sends a message to the backend."}],"blockTags":[{"tag":"@example","content":[{"kind":"code","text":"```typescript\nimport { invoke } from '@tauri-apps/api/tauri';\nawait invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n```"}]},{"tag":"@returns","content":[{"kind":"text","text":"A promise resolving or rejecting to the backend response."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":157,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L157"}],"typeParameter":[{"id":221,"name":"T","variant":"typeParam","kind":131072,"flags":{}}],"parameters":[{"id":222,"name":"cmd","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The command name."}]},"type":{"type":"intrinsic","name":"string"}},{"id":223,"name":"args","variant":"param","kind":32768,"flags":{},"comment":{"summary":[{"kind":"text","text":"The optional arguments to pass to the command."}]},"type":{"type":"reference","target":166,"name":"InvokeArgs","package":"@tauri-apps/api"},"defaultValue":"{}"},{"id":224,"name":"options","variant":"param","kind":32768,"flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The request options."}]},"type":{"type":"reference","target":167,"name":"InvokeOptions","package":"@tauri-apps/api"}}],"type":{"type":"reference","target":{"sourceFileName":"node_modules/typescript/lib/lib.es5.d.ts","qualifiedName":"Promise"},"typeArguments":[{"type":"reference","target":-1,"name":"T","refersToTypeParameter":true}],"name":"Promise","package":"typescript","externalUrl":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"}}]},{"id":169,"name":"transformCallback","variant":"declaration","kind":64,"flags":{},"sources":[{"fileName":"tauri.ts","line":41,"character":9,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L41"}],"signatures":[{"id":170,"name":"transformCallback","variant":"signature","kind":4096,"flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms a callback function to a string identifier that can be passed to the backend.\nThe backend uses the identifier to "},{"kind":"code","text":"`eval()`"},{"kind":"text","text":" the callback."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A unique identifier associated with the callback function."}]},{"tag":"@since","content":[{"kind":"text","text":"1.0.0"}]}]},"sources":[{"fileName":"tauri.ts","line":41,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L41"}],"parameters":[{"id":171,"name":"callback","variant":"param","kind":32768,"flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":172,"name":"__type","variant":"declaration","kind":65536,"flags":{},"sources":[{"fileName":"tauri.ts","line":42,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L42"}],"signatures":[{"id":173,"name":"__type","variant":"signature","kind":4096,"flags":{},"sources":[{"fileName":"tauri.ts","line":42,"character":13,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L42"}],"parameters":[{"id":174,"name":"response","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]}}},{"id":175,"name":"once","variant":"param","kind":32768,"flags":{},"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"}],"type":{"type":"intrinsic","name":"number"}}]}],"groups":[{"title":"Classes","children":[176,199]},{"title":"Interfaces","children":[167]},{"title":"Type Aliases","children":[166]},{"title":"Functions","children":[210,225,219,169]}],"sources":[{"fileName":"tauri.ts","line":1,"character":0,"url":"https://github.com/tauri-apps/tauri/blob/60ae63b58/tooling/api/src/tauri.ts#L1"}]}],"groups":[{"title":"Modules","children":[1,50,64,165]}],"packageName":"@tauri-apps/api","symbolIdMap":{"1":{"sourceFileName":"src/event.ts","qualifiedName":""},"2":{"sourceFileName":"src/event.ts","qualifiedName":"Event"},"3":{"sourceFileName":"src/event.ts","qualifiedName":"Event.event"},"4":{"sourceFileName":"src/event.ts","qualifiedName":"Event.windowLabel"},"5":{"sourceFileName":"src/event.ts","qualifiedName":"Event.id"},"6":{"sourceFileName":"src/event.ts","qualifiedName":"Event.payload"},"7":{"sourceFileName":"src/event.ts","qualifiedName":"Event.T"},"8":{"sourceFileName":"src/event.ts","qualifiedName":"EventCallback"},"9":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"10":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"11":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"12":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"13":{"sourceFileName":"src/event.ts","qualifiedName":"UnlistenFn"},"14":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"15":{"sourceFileName":"src/event.ts","qualifiedName":"__type"},"16":{"sourceFileName":"src/event.ts","qualifiedName":"EventName"},"17":{"sourceFileName":"src/event.ts","qualifiedName":"Options"},"18":{"sourceFileName":"src/event.ts","qualifiedName":"Options.target"},"19":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"20":{"sourceFileName":"src/event.ts","qualifiedName":"listen"},"21":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"22":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"23":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"24":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"25":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"26":{"sourceFileName":"src/event.ts","qualifiedName":"once"},"27":{"sourceFileName":"src/event.ts","qualifiedName":"T"},"28":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"29":{"sourceFileName":"src/event.ts","qualifiedName":"handler"},"30":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"31":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"32":{"sourceFileName":"src/event.ts","qualifiedName":"emit"},"33":{"sourceFileName":"src/event.ts","qualifiedName":"event"},"34":{"sourceFileName":"src/event.ts","qualifiedName":"payload"},"35":{"sourceFileName":"src/event.ts","qualifiedName":"options"},"36":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent"},"37":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_RESIZED"},"38":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_MOVED"},"39":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CLOSE_REQUESTED"},"40":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_CREATED"},"41":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_DESTROYED"},"42":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FOCUS"},"43":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_BLUR"},"44":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_SCALE_FACTOR_CHANGED"},"45":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_THEME_CHANGED"},"46":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP"},"47":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_HOVER"},"48":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.WINDOW_FILE_DROP_CANCELLED"},"49":{"sourceFileName":"src/event.ts","qualifiedName":"TauriEvent.MENU"},"50":{"sourceFileName":"src/mocks.ts","qualifiedName":""},"51":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"52":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockIPC"},"53":{"sourceFileName":"src/mocks.ts","qualifiedName":"cb"},"54":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"55":{"sourceFileName":"src/mocks.ts","qualifiedName":"__type"},"56":{"sourceFileName":"src/mocks.ts","qualifiedName":"cmd"},"57":{"sourceFileName":"src/mocks.ts","qualifiedName":"payload"},"58":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"59":{"sourceFileName":"src/mocks.ts","qualifiedName":"mockWindows"},"60":{"sourceFileName":"src/mocks.ts","qualifiedName":"current"},"61":{"sourceFileName":"src/mocks.ts","qualifiedName":"additionalWindows"},"62":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"63":{"sourceFileName":"src/mocks.ts","qualifiedName":"clearMocks"},"64":{"sourceFileName":"src/path.ts","qualifiedName":""},"65":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory"},"66":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Audio"},"67":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Cache"},"68":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Config"},"69":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Data"},"70":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.LocalData"},"71":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Document"},"72":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Download"},"73":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Picture"},"74":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Public"},"75":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Video"},"76":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Resource"},"77":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Temp"},"78":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppConfig"},"79":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppData"},"80":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLocalData"},"81":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppCache"},"82":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.AppLog"},"83":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Desktop"},"84":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Executable"},"85":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Font"},"86":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Home"},"87":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Runtime"},"88":{"sourceFileName":"src/path.ts","qualifiedName":"BaseDirectory.Template"},"89":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"90":{"sourceFileName":"src/path.ts","qualifiedName":"appConfigDir"},"91":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"92":{"sourceFileName":"src/path.ts","qualifiedName":"appDataDir"},"93":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"94":{"sourceFileName":"src/path.ts","qualifiedName":"appLocalDataDir"},"95":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"96":{"sourceFileName":"src/path.ts","qualifiedName":"appCacheDir"},"97":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"98":{"sourceFileName":"src/path.ts","qualifiedName":"appLogDir"},"99":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"100":{"sourceFileName":"src/path.ts","qualifiedName":"audioDir"},"101":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"102":{"sourceFileName":"src/path.ts","qualifiedName":"cacheDir"},"103":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"104":{"sourceFileName":"src/path.ts","qualifiedName":"configDir"},"105":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"106":{"sourceFileName":"src/path.ts","qualifiedName":"dataDir"},"107":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"108":{"sourceFileName":"src/path.ts","qualifiedName":"desktopDir"},"109":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"110":{"sourceFileName":"src/path.ts","qualifiedName":"documentDir"},"111":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"112":{"sourceFileName":"src/path.ts","qualifiedName":"downloadDir"},"113":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"114":{"sourceFileName":"src/path.ts","qualifiedName":"executableDir"},"115":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"116":{"sourceFileName":"src/path.ts","qualifiedName":"fontDir"},"117":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"118":{"sourceFileName":"src/path.ts","qualifiedName":"homeDir"},"119":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"120":{"sourceFileName":"src/path.ts","qualifiedName":"localDataDir"},"121":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"122":{"sourceFileName":"src/path.ts","qualifiedName":"pictureDir"},"123":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"124":{"sourceFileName":"src/path.ts","qualifiedName":"publicDir"},"125":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"126":{"sourceFileName":"src/path.ts","qualifiedName":"resourceDir"},"127":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"128":{"sourceFileName":"src/path.ts","qualifiedName":"resolveResource"},"129":{"sourceFileName":"src/path.ts","qualifiedName":"resourcePath"},"130":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"131":{"sourceFileName":"src/path.ts","qualifiedName":"runtimeDir"},"132":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"133":{"sourceFileName":"src/path.ts","qualifiedName":"templateDir"},"134":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"135":{"sourceFileName":"src/path.ts","qualifiedName":"videoDir"},"136":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"137":{"sourceFileName":"src/path.ts","qualifiedName":"sep"},"138":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"139":{"sourceFileName":"src/path.ts","qualifiedName":"delimiter"},"140":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"141":{"sourceFileName":"src/path.ts","qualifiedName":"resolve"},"142":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"143":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"144":{"sourceFileName":"src/path.ts","qualifiedName":"normalize"},"145":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"146":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"147":{"sourceFileName":"src/path.ts","qualifiedName":"join"},"148":{"sourceFileName":"src/path.ts","qualifiedName":"paths"},"149":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"150":{"sourceFileName":"src/path.ts","qualifiedName":"dirname"},"151":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"152":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"153":{"sourceFileName":"src/path.ts","qualifiedName":"extname"},"154":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"155":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"156":{"sourceFileName":"src/path.ts","qualifiedName":"basename"},"157":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"158":{"sourceFileName":"src/path.ts","qualifiedName":"ext"},"159":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"160":{"sourceFileName":"src/path.ts","qualifiedName":"isAbsolute"},"161":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"162":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"163":{"sourceFileName":"src/path.ts","qualifiedName":"tempDir"},"164":{"sourceFileName":"src/path.ts","qualifiedName":"path"},"165":{"sourceFileName":"src/tauri.ts","qualifiedName":""},"166":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeArgs"},"167":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions"},"168":{"sourceFileName":"src/tauri.ts","qualifiedName":"InvokeOptions.headers"},"169":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"170":{"sourceFileName":"src/tauri.ts","qualifiedName":"transformCallback"},"171":{"sourceFileName":"src/tauri.ts","qualifiedName":"callback"},"172":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"173":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"174":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"175":{"sourceFileName":"src/tauri.ts","qualifiedName":"once"},"176":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"177":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__constructor"},"178":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel"},"179":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"180":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.id"},"181":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.__TAURI_CHANNEL_MARKER__"},"182":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.#onmessage"},"183":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"184":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"185":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"186":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"187":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"188":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"189":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"190":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"191":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.onmessage"},"192":{"sourceFileName":"src/tauri.ts","qualifiedName":"handler"},"193":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"194":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"195":{"sourceFileName":"src/tauri.ts","qualifiedName":"response"},"196":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"197":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.toJSON"},"198":{"sourceFileName":"src/tauri.ts","qualifiedName":"Channel.T"},"199":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"200":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.__constructor"},"201":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener"},"202":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"203":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"204":{"sourceFileName":"src/tauri.ts","qualifiedName":"channelId"},"205":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.plugin"},"206":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.event"},"207":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.channelId"},"208":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"209":{"sourceFileName":"src/tauri.ts","qualifiedName":"PluginListener.unregister"},"210":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"211":{"sourceFileName":"src/tauri.ts","qualifiedName":"addPluginListener"},"212":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"213":{"sourceFileName":"src/tauri.ts","qualifiedName":"plugin"},"214":{"sourceFileName":"src/tauri.ts","qualifiedName":"event"},"215":{"sourceFileName":"src/tauri.ts","qualifiedName":"cb"},"216":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"217":{"sourceFileName":"src/tauri.ts","qualifiedName":"__type"},"218":{"sourceFileName":"src/tauri.ts","qualifiedName":"payload"},"219":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"220":{"sourceFileName":"src/tauri.ts","qualifiedName":"invoke"},"221":{"sourceFileName":"src/tauri.ts","qualifiedName":"T"},"222":{"sourceFileName":"src/tauri.ts","qualifiedName":"cmd"},"223":{"sourceFileName":"src/tauri.ts","qualifiedName":"args"},"224":{"sourceFileName":"src/tauri.ts","qualifiedName":"options"},"225":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"226":{"sourceFileName":"src/tauri.ts","qualifiedName":"convertFileSrc"},"227":{"sourceFileName":"src/tauri.ts","qualifiedName":"filePath"},"228":{"sourceFileName":"src/tauri.ts","qualifiedName":"protocol"}}} \ No newline at end of file diff --git a/tooling/api/src/index.ts b/tooling/api/src/index.ts index 84d483b58c87..658c39ed82e6 100644 --- a/tooling/api/src/index.ts +++ b/tooling/api/src/index.ts @@ -17,22 +17,6 @@ import * as event from './event' import * as tauri from './tauri' import * as path from './path' -/** @ignore */ -declare global { - interface Window { - __TAURI__: { - path: { - __sep: string - __delimiter: string - } - - convertFileSrc: (src: string, protocol: string) => string - } - - __TAURI_IPC__: (message: any) => void - } -} - /** @ignore */ const invoke = tauri.invoke diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index f1b6d01ef9c6..a986c0cf58a4 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -9,6 +9,22 @@ * @module */ +/** @ignore */ +declare global { + interface Window { + __TAURI__: { + path: { + __sep: string + __delimiter: string + } + + convertFileSrc: (src: string, protocol: string) => string + } + + __TAURI_IPC__: (message: any) => void + } +} + /** @ignore */ function uid(): number { return window.crypto.getRandomValues(new Uint32Array(1))[0] From f450e305c3c4a35cd94b95f6401761682c06fbbc Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 11 Jul 2023 14:27:30 -0300 Subject: [PATCH 70/90] fix csp --- .../test/fixture/src-tauri/tauri.conf.json | 2 +- examples/api/src-tauri/tauri.conf.json | 21 ++++-- examples/commands/tauri.conf.json | 2 +- examples/helloworld/tauri.conf.json | 2 +- examples/isolation/tauri.conf.json | 2 +- examples/multiwindow/tauri.conf.json | 2 +- examples/navigation/tauri.conf.json | 2 +- examples/parent-window/tauri.conf.json | 2 +- examples/resources/src-tauri/tauri.conf.json | 2 +- examples/splashscreen/tauri.conf.json | 2 +- examples/state/tauri.conf.json | 2 +- .../src-tauri/tauri.conf.json | 2 +- .../cpu_intensive/src-tauri/tauri.conf.json | 2 +- .../files_transfer/src-tauri/tauri.conf.json | 2 +- .../helloworld/src-tauri/tauri.conf.json | 2 +- tooling/cli/Cargo.lock | 69 ++++++++++++++++--- tooling/cli/src/migrate/config.rs | 18 ++--- .../vanilla/src-tauri/tauri.conf.json | 2 +- 18 files changed, 101 insertions(+), 37 deletions(-) diff --git a/core/tauri/test/fixture/src-tauri/tauri.conf.json b/core/tauri/test/fixture/src-tauri/tauri.conf.json index 5bf484808dc5..facec1a219b4 100644 --- a/core/tauri/test/fixture/src-tauri/tauri.conf.json +++ b/core/tauri/test/fixture/src-tauri/tauri.conf.json @@ -15,7 +15,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index fca2e7695227..74c601116bea 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -26,7 +26,11 @@ "name": "theme", "takesValue": true, "description": "App theme", - "possibleValues": ["light", "dark", "system"] + "possibleValues": [ + "light", + "dark", + "system" + ] }, { "short": "v", @@ -88,8 +92,10 @@ "security": { "csp": { "default-src": "'self' customprotocol: asset:", - "connect-src": "ipc:", - "font-src": ["https://fonts.gstatic.com"], + "connect-src": "ipc: https://ipc.localhost", + "font-src": [ + "https://fonts.gstatic.com" + ], "img-src": "'self' asset: https://asset.localhost blob: data:", "style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com" }, @@ -97,8 +103,13 @@ "assetProtocol": { "enable": true, "scope": { - "allow": ["$APPDATA/db/**", "$RESOURCE/**"], - "deny": ["$APPDATA/db/*.stronghold"] + "allow": [ + "$APPDATA/db/**", + "$RESOURCE/**" + ], + "deny": [ + "$APPDATA/db/*.stronghold" + ] } } }, diff --git a/examples/commands/tauri.conf.json b/examples/commands/tauri.conf.json index b322c8385ff9..e618bd5472ab 100644 --- a/examples/commands/tauri.conf.json +++ b/examples/commands/tauri.conf.json @@ -51,7 +51,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/helloworld/tauri.conf.json b/examples/helloworld/tauri.conf.json index cbd8f1b4e883..47869b636288 100644 --- a/examples/helloworld/tauri.conf.json +++ b/examples/helloworld/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/isolation/tauri.conf.json b/examples/isolation/tauri.conf.json index 31b914868390..4187fb3c6036 100644 --- a/examples/isolation/tauri.conf.json +++ b/examples/isolation/tauri.conf.json @@ -60,7 +60,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/multiwindow/tauri.conf.json b/examples/multiwindow/tauri.conf.json index 98b2cca3cbc9..533ea9af644d 100644 --- a/examples/multiwindow/tauri.conf.json +++ b/examples/multiwindow/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/navigation/tauri.conf.json b/examples/navigation/tauri.conf.json index acff697c6f8d..c8a352404028 100644 --- a/examples/navigation/tauri.conf.json +++ b/examples/navigation/tauri.conf.json @@ -47,7 +47,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/parent-window/tauri.conf.json b/examples/parent-window/tauri.conf.json index 76e770f87b12..b19c511f00c6 100644 --- a/examples/parent-window/tauri.conf.json +++ b/examples/parent-window/tauri.conf.json @@ -31,7 +31,7 @@ "category": "DeveloperTool" }, "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/resources/src-tauri/tauri.conf.json b/examples/resources/src-tauri/tauri.conf.json index 5f89101744b4..85777f4273a3 100644 --- a/examples/resources/src-tauri/tauri.conf.json +++ b/examples/resources/src-tauri/tauri.conf.json @@ -53,7 +53,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/splashscreen/tauri.conf.json b/examples/splashscreen/tauri.conf.json index c8d74461951a..69b17a36e3a3 100644 --- a/examples/splashscreen/tauri.conf.json +++ b/examples/splashscreen/tauri.conf.json @@ -44,7 +44,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/state/tauri.conf.json b/examples/state/tauri.conf.json index 7973bc2a55e2..d09175aaeb50 100644 --- a/examples/state/tauri.conf.json +++ b/examples/state/tauri.conf.json @@ -51,7 +51,7 @@ } ], "security": { - "csp": "default-src 'self'; connect-src ipc:" + "csp": "default-src 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json index d743394612d2..a7d9b6a090d7 100644 --- a/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json +++ b/examples/tauri-dynamic-lib/src-tauri/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json index 8b63077b090c..eae6098e9823 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/cpu_intensive/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json index 8b63077b090c..eae6098e9823 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/files_transfer/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json index 8b63077b090c..eae6098e9823 100644 --- a/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json +++ b/tooling/bench/tests/helloworld/src-tauri/tauri.conf.json @@ -43,7 +43,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 161e639fbe75..4f3736783cbe 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -1502,7 +1502,21 @@ checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" dependencies = [ "log", "mac", - "markup5ever", + "markup5ever 0.10.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "html5ever" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" +dependencies = [ + "log", + "mac", + "markup5ever 0.11.0", "proc-macro2", "quote", "syn 1.0.109", @@ -2002,7 +2016,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" dependencies = [ "cssparser", - "html5ever", + "html5ever 0.25.2", + "matches", + "selectors", +] + +[[package]] +name = "kuchikiki" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" +dependencies = [ + "cssparser", + "html5ever 0.26.0", + "indexmap", "matches", "selectors", ] @@ -2137,7 +2164,21 @@ checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" dependencies = [ "log", "phf 0.8.0", - "phf_codegen", + "phf_codegen 0.8.0", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "markup5ever" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" +dependencies = [ + "log", + "phf 0.10.1", + "phf_codegen 0.10.0", "string_cache", "string_cache_codegen", "tendril", @@ -2729,6 +2770,16 @@ dependencies = [ "phf_shared 0.8.0", ] +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + [[package]] name = "phf_generator" version = "0.8.0" @@ -3335,7 +3386,7 @@ dependencies = [ "log", "matches", "phf 0.8.0", - "phf_codegen", + "phf_codegen 0.8.0", "precomputed-hash", "servo_arc", "smallvec", @@ -3896,7 +3947,7 @@ dependencies = [ "env_logger", "handlebars 4.3.7", "heck", - "html5ever", + "html5ever 0.26.0", "ignore", "image", "include_dir", @@ -3907,7 +3958,7 @@ dependencies = [ "jsonrpsee-core", "jsonrpsee-ws-client", "jsonschema", - "kuchiki", + "kuchikiki", "libc", "local-ip-address", "log", @@ -4012,7 +4063,7 @@ dependencies = [ "ctor 0.1.26", "getrandom 0.2.9", "heck", - "html5ever", + "html5ever 0.25.2", "infer", "json-patch", "json5", @@ -4041,11 +4092,11 @@ dependencies = [ "getrandom 0.2.9", "glob", "heck", - "html5ever", + "html5ever 0.26.0", "infer", "json-patch", "json5", - "kuchiki", + "kuchikiki", "memchr", "phf 0.10.1", "schemars", diff --git a/tooling/cli/src/migrate/config.rs b/tooling/cli/src/migrate/config.rs index 452784c2f20b..a9ea92327b91 100644 --- a/tooling/cli/src/migrate/config.rs +++ b/tooling/cli/src/migrate/config.rs @@ -81,20 +81,22 @@ fn process_security(security: &mut Map) -> Result<()> { match &mut csp { tauri_utils_v1::config::Csp::Policy(csp) => { if csp.contains("connect-src") { - *csp = csp.replace("connect-src", "connect-src ipc:"); + *csp = csp.replace("connect-src", "connect-src ipc: https://ipc.localhost"); } else { - *csp = format!("{csp}; connect-src ipc:"); + *csp = format!("{csp}; connect-src ipc: https://ipc.localhost"); } } tauri_utils_v1::config::Csp::DirectiveMap(csp) => { if let Some(connect_src) = csp.get_mut("connect-src") { - if !connect_src.contains("ipc:") { - connect_src.push("ipc:"); + if !connect_src.contains("ipc: https://ipc.localhost") { + connect_src.push("ipc: https://ipc.localhost"); } } else { csp.insert( "connect-src".into(), - tauri_utils_v1::config::CspDirectiveSources::List(vec!["ipc:".to_string()]), + tauri_utils_v1::config::CspDirectiveSources::List(vec![ + "ipc: https://ipc.localhost".to_string() + ]), ); } } @@ -325,7 +327,7 @@ mod test { assert_eq!( migrated["tauri"]["security"]["csp"], format!( - "{}; connect-src ipc:", + "{}; connect-src ipc: https://ipc.localhost", original["tauri"]["security"]["csp"].as_str().unwrap() ) ); @@ -352,7 +354,7 @@ mod test { assert!(migrated["tauri"]["security"]["csp"]["connect-src"] .as_array() .expect("connect-src isn't an array") - .contains(&"ipc:".into())); + .contains(&"ipc: https://ipc.localhost".into())); } #[test] @@ -379,7 +381,7 @@ mod test { .as_str() .expect("connect-src isn't a string"), format!( - "{} ipc:", + "{} ipc: https://ipc.localhost", original["tauri"]["security"]["csp"]["connect-src"] .as_str() .unwrap() diff --git a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json index d5ae6fa4a135..787dadd50f1b 100644 --- a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json +++ b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/tauri.conf.json @@ -50,7 +50,7 @@ } ], "security": { - "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc:" + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: https://ipc.localhost" } } } \ No newline at end of file From 0d69873a6a21cba6717825f06a893006ee955f8b Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 17 Jul 2023 10:26:27 -0300 Subject: [PATCH 71/90] change channel id to u32 --- core/tauri/src/ipc/channel.rs | 6 +++--- core/tauri/src/ipc/mod.rs | 2 +- core/tauri/src/plugin/mobile.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index aa19b0aacdaa..1dfb86b63ee8 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -29,7 +29,7 @@ pub struct ChannelDataCache(pub(crate) Arc>>); /// An IPC channel. #[derive(Clone)] pub struct Channel { - id: usize, + id: u32, on_message: Arc crate::Result<()> + Send + Sync>, } @@ -51,7 +51,7 @@ impl Channel { } pub(crate) fn _new crate::Result<()> + Send + Sync + 'static>( - id: usize, + id: u32, on_message: F, ) -> Self { #[allow(clippy::let_and_return)] @@ -94,7 +94,7 @@ impl Channel { } /// The channel identifier. - pub fn id(&self) -> usize { + pub fn id(&self) -> u32 { self.id } diff --git a/core/tauri/src/ipc/mod.rs b/core/tauri/src/ipc/mod.rs index a09869be4e18..c55db11c2f0a 100644 --- a/core/tauri/src/ipc/mod.rs +++ b/core/tauri/src/ipc/mod.rs @@ -490,4 +490,4 @@ impl InvokeMessage { /// The `Callback` type is the return value of the `transformCallback` JavaScript function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] -pub struct CallbackFn(pub usize); +pub struct CallbackFn(pub u32); diff --git a/core/tauri/src/plugin/mobile.rs b/core/tauri/src/plugin/mobile.rs index 9e507db4684f..9b15f2cfce3c 100644 --- a/core/tauri/src/plugin/mobile.rs +++ b/core/tauri/src/plugin/mobile.rs @@ -26,7 +26,7 @@ type PendingPluginCallHandler = Box static PENDING_PLUGIN_CALLS: OnceCell>> = OnceCell::new(); -static CHANNELS: OnceCell>> = OnceCell::new(); +static CHANNELS: OnceCell>> = OnceCell::new(); /// Possible errors when invoking a plugin. #[derive(Debug, thiserror::Error)] @@ -113,7 +113,7 @@ pub fn send_channel_data( .get_or_init(Default::default) .lock() .unwrap() - .get(&(channel_id as usize)) + .get(&(channel_id as u32)) { let _ = channel.send(data); } @@ -354,7 +354,7 @@ pub(crate) fn run_command, F: FnOnce(PluginResponse) + .get_or_init(Default::default) .lock() .unwrap() - .get(&(id as usize)) + .get(&(id as u32)) { let payload: serde_json::Value = serde_json::from_str(payload.to_str().unwrap()).unwrap(); let _ = channel.send(payload); From 52e77997ce5e597f4921af9f9f4614c68f11ff38 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Mon, 17 Jul 2023 19:29:32 -0300 Subject: [PATCH 72/90] fix linux tests --- core/tauri/src/ipc/format_callback.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/src/ipc/format_callback.rs b/core/tauri/src/ipc/format_callback.rs index f149567abf1b..31d7cbc599d1 100644 --- a/core/tauri/src/ipc/format_callback.rs +++ b/core/tauri/src/ipc/format_callback.rs @@ -126,7 +126,7 @@ mod test { impl Arbitrary for CallbackFn { fn arbitrary(g: &mut Gen) -> CallbackFn { - CallbackFn(usize::arbitrary(g)) + CallbackFn(u32::arbitrary(g)) } } From 7536e248af8f248674869e731a8398d6e3bd8939 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:11:19 -0300 Subject: [PATCH 73/90] rename ChannelDataCache to ChannelDataIpcQueue --- core/tauri/src/app.rs | 4 ++-- core/tauri/src/ipc/channel.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 96a42bdf12b5..a09fb9131011 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -8,7 +8,7 @@ pub(crate) mod tray; use crate::{ command::{CommandArg, CommandItem}, ipc::{ - channel::ChannelDataCache, CallbackFn, Invoke, InvokeError, InvokeHandler, InvokeResponder, + channel::ChannelDataIpcQueue, CallbackFn, Invoke, InvokeError, InvokeHandler, InvokeResponder, InvokeResponse, }, manager::{Asset, CustomProtocol, WindowManager}, @@ -1406,7 +1406,7 @@ impl Builder { asset_protocol: FsScope::for_fs_api(&app, &app.config().tauri.security.asset_protocol.scope)?, }); - app.manage(ChannelDataCache::default()); + app.manage(ChannelDataIpcQueue::default()); app.handle.plugin(crate::ipc::channel::plugin())?; #[cfg(windows)] diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index 1dfb86b63ee8..83c56641001c 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -23,8 +23,9 @@ pub const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; // TODO: ideally this const references CHANNEL_PLUGIN_NAME pub const FETCH_CHANNEL_DATA_COMMAND: &str = "plugin:__TAURI_CHANNEL__|fetch"; +/// Maps a channel id to a pending data that must be send to the JavaScript side via the IPC. #[derive(Default, Clone)] -pub struct ChannelDataCache(pub(crate) Arc>>); +pub struct ChannelDataIpcQueue(pub(crate) Arc>>); /// An IPC channel. #[derive(Clone)] @@ -70,7 +71,7 @@ impl Channel { Channel::_new(callback.0, move |body| { let data_id = rand::random(); window - .state::() + .state::() .0 .lock() .unwrap() @@ -124,7 +125,7 @@ impl<'de, R: Runtime> CommandArg<'de, R> for Channel { #[command(root = "crate")] fn fetch( request: Request<'_>, - cache: State<'_, ChannelDataCache>, + cache: State<'_, ChannelDataIpcQueue>, ) -> Result { if let Some(id) = request .headers() From 75220d97dfe3f24dfae215ca58cd971fb01cfad9 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:14:46 -0300 Subject: [PATCH 74/90] use constants for header names --- core/tauri/src/ipc/protocol.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index af2846974ba5..888872e29c10 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -16,6 +16,9 @@ use crate::{ use super::{CallbackFn, InvokeBody, InvokeResponse}; +const TAURI_CALLBACK_HEADER_NAME: &str = "Tauri-Callback"; +const TAURI_ERROR_HEADER_NAME: &str = "Tauri-Error"; + #[cfg(not(ipc_custom_protocol))] pub fn message_handler( manager: WindowManager, @@ -221,22 +224,22 @@ fn handle_ipc_request( let callback = CallbackFn( request .headers() - .get("Tauri-Callback") + .get(TAURI_CALLBACK_HEADER_NAME) .ok_or("missing Tauri-Callback header")? .to_str() - .map_err(|_| "Tauri-Callback header value must be a string")? + .map_err(|_| "Tauri callback header value must be a string")? .parse() - .map_err(|_| "Tauri-Callback header value must be a numeric string")?, + .map_err(|_| "Tauri callback header value must be a numeric string")?, ); let error = CallbackFn( request .headers() - .get("Tauri-Error") + .get(TAURI_ERROR_HEADER_NAME) .ok_or("missing Tauri-Error header")? .to_str() - .map_err(|_| "Tauri-Error header value must be a string")? + .map_err(|_| "Tauri error header value must be a string")? .parse() - .map_err(|_| "Tauri-Error header value must be a numeric string")?, + .map_err(|_| "Tauri error header value must be a numeric string")?, ); let content_type = request From 1586b2c838a0a32fccf14ff8a4612ad34a5bef8a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:15:01 -0300 Subject: [PATCH 75/90] create isolation message obj with Object.create(null) --- core/tauri-utils/src/pattern/isolation.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 80fcb753ee68..83d1fcf2d743 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -103,7 +103,14 @@ data = await window.__TAURI_ISOLATION_HOOK__(data) } - const { cmd, callback, error, payload, options } = data + const message = Object.create(null) + message.cmd = data.cmd + message.callback = data.callback + message.error = data.error + message.options = data.options + message.payload = await encrypt(data.payload) + sendMessage(message) + sendMessage({ cmd, callback, From b66779938868e8a3949a8e66b9d2404a910a855f Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Aug 2023 18:15:18 -0300 Subject: [PATCH 76/90] Update core/tauri/scripts/ipc-protocol.js [skip ci] Co-authored-by: chip --- core/tauri/scripts/ipc-protocol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index cc396a58fc83..03575524a3f6 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -(function () { +;(function () { const processIpcMessage = __RAW_process_ipc_message_fn__ const osName = __TEMPLATE_os_name__ const fetchChannelDataCommand = __TEMPLATE_fetch_channel_data_command__ From b5b180119052d1d44c5a851c379b604a7ac2b84d Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Aug 2023 18:15:43 -0300 Subject: [PATCH 77/90] Update core/tauri/scripts/ipc-protocol.js [skip ci] Co-authored-by: chip --- core/tauri/scripts/ipc-protocol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/scripts/ipc-protocol.js b/core/tauri/scripts/ipc-protocol.js index 03575524a3f6..724284af80b0 100644 --- a/core/tauri/scripts/ipc-protocol.js +++ b/core/tauri/scripts/ipc-protocol.js @@ -13,7 +13,7 @@ const { cmd, callback, error, payload, options } = message // use custom protocol for IPC if the flag is set to true, the command is the fetch data command or when not on Linux/Android - if (useCustomProtocol || cmd == fetchChannelDataCommand || (osName !== 'linux' && osName !== 'android')) { + if (useCustomProtocol || cmd === fetchChannelDataCommand || (osName !== 'linux' && osName !== 'android')) { const { contentType, data } = processIpcMessage(payload) fetch(window.__TAURI__.convertFileSrc(cmd, 'ipc'), { method: 'POST', From 924803323a392c118b6c3583282e35a196ad3c98 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Aug 2023 18:16:22 -0300 Subject: [PATCH 78/90] Update tooling/api/src/tauri.ts [skip ci] Co-authored-by: chip --- tooling/api/src/tauri.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index a986c0cf58a4..733039733db0 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -182,7 +182,7 @@ async function invoke( /** * Convert a device file path to an URL that can be loaded by the webview. * Note that `asset:` and `https://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`. - * Example CSP value: `"csp": "default-src 'self' ipc:; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources. + * Example CSP value: `"csp": "default-src 'self' ipc: https://ipc.localhost; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources. * * Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol) * in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object. From 3fdba5f800ba93414ad61faa1522ca3b29774692 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Aug 2023 18:17:19 -0300 Subject: [PATCH 79/90] Update core/tauri/src/ipc/protocol.rs [skip ci] Co-authored-by: chip --- core/tauri/src/ipc/protocol.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index af2846974ba5..f474bce3c76e 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -208,14 +208,9 @@ fn handle_ipc_request( // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it #[cfg(all(feature = "isolation", ipc_custom_protocol))] if let crate::Pattern::Isolation { crypto_keys, .. } = manager.pattern() { - match crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) + body = crate::utils::pattern::isolation::RawIsolationPayload::try_from(&body) .and_then(|raw| crypto_keys.decrypt(raw)) - { - Ok(data) => body = data, - Err(e) => { - return Err(e.to_string()); - } - } + .map_err(|e| e.to_string())?; } let callback = CallbackFn( From 20120201508ed19509ee4175fb65256ce373593a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:48:56 -0300 Subject: [PATCH 80/90] use mime crate --- core/tauri/Cargo.toml | 1 + core/tauri/src/ipc/protocol.rs | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 6e0c74b4598b..fa93ba5f9b59 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -61,6 +61,7 @@ reqwest = { version = "0.11", default-features = false, features = [ "json", "st bytes = { version = "1", features = [ "serde" ] } raw-window-handle = "0.5" glob = "0.3" +mime = "0.3" data-url = { version = "0.2", optional = true } serialize-to-javascript = "=0.1.1" infer = { version = "0.9", optional = true } diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 888872e29c10..87a700c19ada 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -246,17 +246,22 @@ fn handle_ipc_request( .headers() .get(reqwest::header::CONTENT_TYPE) .and_then(|h| h.to_str().ok()) - .unwrap_or("application/octet-stream"); - let body = match content_type { - "application/octet-stream" => body.into(), - // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it - #[cfg(not(ipc_custom_protocol))] - "application/json" => serde_json::Value::Object(Default::default()).into(), - #[cfg(ipc_custom_protocol)] - "application/json" => serde_json::from_slice::(&body) - .map_err(|e| e.to_string())? - .into(), - _ => return Err(format!("unknown content type {content_type}")), + .map(|mime| mime.parse()) + .unwrap_or(Ok(mime::APPLICATION_OCTET_STREAM)) + .map_err(|_| "unknown content type")?; + let body = if content_type == mime::APPLICATION_OCTET_STREAM { + body.into() + } else if content_type == mime::APPLICATION_JSON { + if cfg!(ipc_custom_protocol) { + serde_json::from_slice::(&body) + .map_err(|e| e.to_string())? + .into() + } else { + // the body is not set if ipc_custom_protocol is not enabled so we'll just ignore it + serde_json::Value::Object(Default::default()).into() + } + } else { + return Err(format!("content type {content_type} is not implemented")); }; let payload = InvokeRequest { From 7e37cfe2f65508d4750779572d72aa6775767af9 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:53:19 -0300 Subject: [PATCH 81/90] no need for fn to be unsafe, document --- core/tauri/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 49383b3d4f9c..861f96c5fe26 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -128,19 +128,15 @@ macro_rules! android_binding { [i64, JString], ); + // this function is a glue between PluginManager.kt > handlePluginResponse and Rust #[allow(non_snake_case)] - pub unsafe fn handlePluginResponse( - env: JNIEnv, - _: JClass, - id: i32, - success: JString, - error: JString, - ) { + pub fn handlePluginResponse(env: JNIEnv, _: JClass, id: i32, success: JString, error: JString) { ::tauri::handle_android_plugin_response(env, id, success, error); } + // this function is a glue between PluginManager.kt > sendChannelData and Rust #[allow(non_snake_case)] - pub unsafe fn sendChannelData(env: JNIEnv, _: JClass, id: i64, data: JString) { + pub fn sendChannelData(env: JNIEnv, _: JClass, id: i64, data: JString) { ::tauri::send_channel_data(env, id, data); } }; From 4d60e94786b46488344351ab76c59341426d0c3e Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 18:59:58 -0300 Subject: [PATCH 82/90] fix example --- examples/api/src-tauri/Cargo.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 99fe15a24999..c6eac0884eb8 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3243,9 +3243,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b87728a671df8520c274fa9bed48d7384f5a965ef2fc364f01a942f6ff1ae6d2" +checksum = "436fb014010f6c87561125b14add8a6091354681f190bb9ffeb42819af9218a4" dependencies = [ "bitflags", "cairo-rs", @@ -3329,6 +3329,7 @@ dependencies = [ "jni", "libc", "log", + "mime", "objc", "once_cell", "percent-encoding", From f47e3007c6e7ae95b100cbaa37d05e19a6752167 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 9 Aug 2023 19:00:46 -0300 Subject: [PATCH 83/90] remove old sendMessage call --- core/tauri-utils/src/pattern/isolation.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js index 83d1fcf2d743..e236839aabb0 100644 --- a/core/tauri-utils/src/pattern/isolation.js +++ b/core/tauri-utils/src/pattern/isolation.js @@ -8,7 +8,8 @@ * isolation frame -> main frame = isolation message */ -;(async function () { +; +(async function () { /** * Sends the message to the isolation frame. * @param {any} message @@ -110,14 +111,6 @@ message.options = data.options message.payload = await encrypt(data.payload) sendMessage(message) - - sendMessage({ - cmd, - callback, - error, - payload: await encrypt(payload), - options - }) } window.addEventListener('message', payloadHandler, false) From 1e8513a55f9a8e8dcc65c8a73704d59e0d0abf6a Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Aug 2023 19:04:35 -0300 Subject: [PATCH 84/90] Update core/tauri/scripts/process-ipc-message-fn.js Co-authored-by: chip --- core/tauri/scripts/process-ipc-message-fn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js index 6e421e6924b8..7eda0cef1d67 100644 --- a/core/tauri/scripts/process-ipc-message-fn.js +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -(function (message) { +;(function (message) { if (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) { return { contentType: 'application/octet-stream', From fecca1e08233f6198b8a14171b70ef7e961adc7f Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 8 Aug 2023 16:42:31 -0300 Subject: [PATCH 85/90] downgrade time --- .github/workflows/test-core.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index b816d4eb2712..6b604201cd88 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -98,6 +98,11 @@ jobs: workspaces: core -> ../target save-if: ${{ matrix.features.key == 'all' }} + - name: Downgrade crates with MSRV conflict + # The --precise flag can only be used once per invocation. + run: | + cargo update -p time --precise 0.3.23 + - name: test uses: actions-rs/cargo@v1 with: From 13369516c3232eaac0e50cd3333f9a043448b257 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 10 Aug 2023 07:41:55 -0300 Subject: [PATCH 86/90] move tauri-channel-id to const --- core/tauri/src/ipc/channel.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/tauri/src/ipc/channel.rs b/core/tauri/src/ipc/channel.rs index 83c56641001c..e09a8d922b53 100644 --- a/core/tauri/src/ipc/channel.rs +++ b/core/tauri/src/ipc/channel.rs @@ -22,6 +22,7 @@ pub const IPC_PAYLOAD_PREFIX: &str = "__CHANNEL__:"; pub const CHANNEL_PLUGIN_NAME: &str = "__TAURI_CHANNEL__"; // TODO: ideally this const references CHANNEL_PLUGIN_NAME pub const FETCH_CHANNEL_DATA_COMMAND: &str = "plugin:__TAURI_CHANNEL__|fetch"; +pub(crate) const CHANNEL_ID_HEADER_NAME: &str = "Tauri-Channel-Id"; /// Maps a channel id to a pending data that must be send to the JavaScript side via the IPC. #[derive(Default, Clone)] @@ -77,7 +78,7 @@ impl Channel { .unwrap() .insert(data_id, body); window.eval(&format!( - "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ 'Tauri-Channel-Id': {data_id} }} }}).then(window['_' + {}]).catch(console.error)", + "__TAURI_INVOKE__('{FETCH_CHANNEL_DATA_COMMAND}', null, {{ headers: {{ '{CHANNEL_ID_HEADER_NAME}': {data_id} }} }}).then(window['_' + {}]).catch(console.error)", callback.0 )) }) @@ -129,7 +130,7 @@ fn fetch( ) -> Result { if let Some(id) = request .headers() - .get("Tauri-Channel-Id") + .get(CHANNEL_ID_HEADER_NAME) .and_then(|v| v.to_str().ok()) .and_then(|id| id.parse().ok()) { @@ -139,7 +140,7 @@ fn fetch( Err("data not found") } } else { - Err("missing Tauri-Channel-Id header") + Err("missing channel id header") } } From c2b8f107a016399af27e887523c0e6e23adabab3 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 10 Aug 2023 07:43:27 -0300 Subject: [PATCH 87/90] remove semicolon we use this as a raw function instead of calling it directly --- core/tauri/scripts/process-ipc-message-fn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js index 7eda0cef1d67..6e421e6924b8 100644 --- a/core/tauri/scripts/process-ipc-message-fn.js +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -;(function (message) { +(function (message) { if (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) { return { contentType: 'application/octet-stream', From 7023920e72935c9180a1859c70a9253fa426ccfe Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 10 Aug 2023 07:44:54 -0300 Subject: [PATCH 88/90] use mime crate --- core/tauri/src/ipc/protocol.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 2a9e650e8759..2662a439588f 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -34,25 +34,25 @@ pub fn get(manager: WindowManager, label: String) -> UriSchemePro Ok(data) => match data { InvokeResponse::Ok(InvokeBody::Json(v)) => ( HttpResponse::new(serde_json::to_vec(&v)?.into()), - "application/json", + mime::APPLICATION_JSON, ), InvokeResponse::Ok(InvokeBody::Raw(v)) => { - (HttpResponse::new(v.into()), "application/octet-stream") + (HttpResponse::new(v.into()), mime::APPLICATION_OCTET_STREAM) } InvokeResponse::Err(e) => { let mut response = HttpResponse::new(serde_json::to_vec(&e.0)?.into()); response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") + (response, mime::TEXT_PLAIN) } }, Err(e) => { let mut response = HttpResponse::new(e.as_bytes().to_vec().into()); response.set_status(StatusCode::BAD_REQUEST); - (response, "text/plain") + (response, mime::TEXT_PLAIN) } }; - response.set_mimetype(Some(content_type.into())); + response.set_mimetype(Some(content_type.essence_str().into())); response } From 2353a638519d2cebd6ed6c88e56b917c43643d48 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 10 Aug 2023 09:08:26 -0300 Subject: [PATCH 89/90] add comment [skip ci] --- core/tauri/scripts/process-ipc-message-fn.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tauri/scripts/process-ipc-message-fn.js b/core/tauri/scripts/process-ipc-message-fn.js index 6e421e6924b8..2e8dade7bdad 100644 --- a/core/tauri/scripts/process-ipc-message-fn.js +++ b/core/tauri/scripts/process-ipc-message-fn.js @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +// this is a function and not an iife so use it carefully + (function (message) { if (message instanceof ArrayBuffer || ArrayBuffer.isView(message) || Array.isArray(message)) { return { From f5929648ea707c4dacd910f7b5eeb6ac3a5a44bf Mon Sep 17 00:00:00 2001 From: Chip Reed Date: Thu, 10 Aug 2023 14:16:34 +0200 Subject: [PATCH 90/90] use mime for last missed literal --- core/tauri/src/ipc/protocol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tauri/src/ipc/protocol.rs b/core/tauri/src/ipc/protocol.rs index 2662a439588f..60883c5c88e2 100644 --- a/core/tauri/src/ipc/protocol.rs +++ b/core/tauri/src/ipc/protocol.rs @@ -74,7 +74,7 @@ pub fn get(manager: WindowManager, label: String) -> UriSchemePro .into(), ); r.set_status(StatusCode::METHOD_NOT_ALLOWED); - r.set_mimetype(Some("text/plain".into())); + r.set_mimetype(Some(mime::TEXT_PLAIN.essence_str().into())); r } };