@tauri-apps/api
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -9,3 +9,3 @@ /** | ||
* | ||
* @returns A promise resolving to the application version. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -21,7 +21,7 @@ declare function getVersion(): Promise<string>; | ||
* | ||
* @returns A promise resolving to application name. | ||
* @since 1.0.0 | ||
*/ | ||
declare function getName(): Promise<string>; | ||
/** | ||
* Gets the tauri version. | ||
* Gets the Tauri version. | ||
* | ||
@@ -34,5 +34,5 @@ * @example | ||
* | ||
* @returns A promise resolving to tauri version. | ||
* @since 1.0.0 | ||
*/ | ||
declare function getTauriVersion(): Promise<string>; | ||
export { getName, getVersion, getTauriVersion }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{g as getName,c as getTauriVersion,b as getVersion}from"./app-ea395091.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{g as getName,c as getTauriVersion,b as getVersion}from"./app-e71555b6.js";import"./tauri-a4b3335a.js"; |
# Changelog | ||
## \[1.1.0] | ||
- Update `mockIPC()` handler signature to allow async handler functions. | ||
- [4fa968dc](https://www.github.com/tauri-apps/tauri/commit/4fa968dc0e74b5206bfcd54e704d180c16b67b08) fix(api): add async `mockIPC()` handler signature ([#5056](https://www.github.com/tauri-apps/tauri/pull/5056)) on 2022-08-26 | ||
- Improve shell's `Command`, `Command.stdout` and `Command.stderr` events with new `once`, `off`, `listenerCount`, `prependListener`, `prependOnceListener` and `removeAllListeners` functions. | ||
- [aa9f1243](https://www.github.com/tauri-apps/tauri/commit/aa9f1243e6c1629972a82e469f20c8399741740e) Improved EventEmitter for tauri api shell ([#4697](https://www.github.com/tauri-apps/tauri/pull/4697)) on 2022-07-26 | ||
- Added the `encoding` option to the `Command` options. | ||
- [d8cf9f9f](https://www.github.com/tauri-apps/tauri/commit/d8cf9f9fcd617ac24fa418952fd4a32c08804f5c) Command support for specified character encoding, closes [#4644](https://www.github.com/tauri-apps/tauri/pull/4644) ([#4772](https://www.github.com/tauri-apps/tauri/pull/4772)) on 2022-07-28 | ||
- Add `exists` function to the fs module. | ||
- [3c62dbc9](https://www.github.com/tauri-apps/tauri/commit/3c62dbc902c904d35a7472ce72a969084c95fbbe) feat(api): Add `exists` function to the fs module. ([#5060](https://www.github.com/tauri-apps/tauri/pull/5060)) on 2022-09-15 | ||
## \[1.0.2] | ||
@@ -4,0 +15,0 @@ |
13
cli.d.ts
@@ -0,1 +1,4 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface ArgMatch { | ||
@@ -13,2 +16,5 @@ /** | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface SubcommandMatch { | ||
@@ -18,2 +24,5 @@ name: string; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface CliMatches { | ||
@@ -26,3 +35,3 @@ args: { | ||
/** | ||
* Parse the arguments provided to the current process and get the matches using the configuration defined `tauri.conf.json > tauri > cli`. | ||
* Parse the arguments provided to the current process and get the matches using the configuration defined [`tauri.cli`](https://tauri.app/v1/api/config/#tauriconfig.cli) in `tauri.conf.json` | ||
* @example | ||
@@ -44,3 +53,3 @@ * ```typescript | ||
* | ||
* @returns A promise resolving to the parsed arguments. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -47,0 +56,0 @@ declare function getMatches(): Promise<CliMatches>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{g as getMatches}from"./cli-0a14b129.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{g as getMatches}from"./cli-152ced64.js";import"./tauri-a4b3335a.js"; |
/** | ||
* Writes a plain text to the clipboard. | ||
* Writes plain text to the clipboard. | ||
* @example | ||
@@ -11,2 +11,4 @@ * ```typescript | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0. | ||
*/ | ||
@@ -21,6 +23,5 @@ declare function writeText(text: string): Promise<void>; | ||
* ``` | ||
* | ||
* @returns A promise resolving to the clipboard content as plain text. | ||
* @since 1.0.0. | ||
*/ | ||
declare function readText(): Promise<string | null>; | ||
export { writeText, readText }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{r as readText,w as writeText}from"./clipboard-6ac7f168.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{r as readText,w as writeText}from"./clipboard-4edc6511.js";import"./tauri-a4b3335a.js"; |
@@ -1,2 +0,6 @@ | ||
/** Extension filters for the file dialog. */ | ||
/** | ||
* Extension filters for the file dialog. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface DialogFilter { | ||
@@ -14,3 +18,7 @@ /** Filter name. */ | ||
} | ||
/** Options for the open dialog. */ | ||
/** | ||
* Options for the open dialog. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface OpenDialogOptions { | ||
@@ -33,3 +41,7 @@ /** The title of the dialog window. */ | ||
} | ||
/** Options for the save dialog. */ | ||
/** | ||
* Options for the save dialog. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface SaveDialogOptions { | ||
@@ -47,2 +59,5 @@ /** The title of the dialog window. */ | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface MessageDialogOptions { | ||
@@ -103,2 +118,4 @@ /** The title of the dialog. Defaults to the app name. */ | ||
* @returns A promise resolving to the selected path(s) | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -128,2 +145,4 @@ declare function open(options?: OpenDialogOptions): Promise<null | string | string[]>; | ||
* @returns A promise resolving to the selected path. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -140,6 +159,9 @@ declare function save(options?: SaveDialogOptions): Promise<string>; | ||
* | ||
* @param {string} message The message to show. | ||
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title. | ||
* @param message The message to show. | ||
* @param options The dialog's options. If a string, it represents the dialog title. | ||
* | ||
* @return {Promise<void>} A promise indicating the success or failure of the operation. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
* | ||
*/ | ||
@@ -156,6 +178,8 @@ declare function message(message: string, options?: string | MessageDialogOptions): Promise<void>; | ||
* | ||
* @param {string} message The message to show. | ||
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title. | ||
* @param message The message to show. | ||
* @param options The dialog's options. If a string, it represents the dialog title. | ||
* | ||
* @return {Promise<void>} A promise resolving to a boolean indicating whether `Yes` was clicked or not. | ||
* @returns A promise resolving to a boolean indicating whether `Yes` was clicked or not. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -172,6 +196,8 @@ declare function ask(message: string, options?: string | MessageDialogOptions): Promise<boolean>; | ||
* | ||
* @param {string} message The message to show. | ||
* @param {string|MessageDialogOptions|undefined} options The dialog's options. If a string, it represents the dialog title. | ||
* @param message The message to show. | ||
* @param options The dialog's options. If a string, it represents the dialog title. | ||
* | ||
* @return {Promise<void>} A promise resolving to a boolean indicating whether `Ok` was clicked or not. | ||
* @returns A promise resolving to a boolean indicating whether `Ok` was clicked or not. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -178,0 +204,0 @@ declare function confirm(message: string, options?: string | MessageDialogOptions): Promise<boolean>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{a as ask,c as confirm,m as message,o as open,s as save}from"./dialog-37b7acba.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{a as ask,c as confirm,m as message,o as open,s as save}from"./dialog-5c2a33bf.js";import"./tauri-a4b3335a.js"; |
@@ -1,3 +0,27 @@ | ||
import type { EventName, EventCallback, UnlistenFn, Event } from './helpers/event'; | ||
import type { EventCallback, UnlistenFn, Event } from './helpers/event'; | ||
export declare type EventName = TauriEvent | string; | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
export declare enum TauriEvent { | ||
WINDOW_RESIZED = "tauri://resize", | ||
WINDOW_MOVED = "tauri://move", | ||
WINDOW_CLOSE_REQUESTED = "tauri://close-requested", | ||
WINDOW_CREATED = "tauri://window-created", | ||
WINDOW_DESTROYED = "tauri://destroyed", | ||
WINDOW_FOCUS = "tauri://focus", | ||
WINDOW_BLUR = "tauri://blur", | ||
WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", | ||
WINDOW_THEME_CHANGED = "tauri://theme-changed", | ||
WINDOW_FILE_DROP = "tauri://file-drop", | ||
WINDOW_FILE_DROP_HOVER = "tauri://file-drop-hover", | ||
WINDOW_FILE_DROP_CANCELLED = "tauri://file-drop-cancelled", | ||
MENU = "tauri://menu", | ||
CHECK_UPDATE = "tauri://update", | ||
UPDATE_AVAILABLE = "tauri://update-available", | ||
INSTALL_UPDATE = "tauri://update-install", | ||
STATUS_UPDATE = "tauri://update-status", | ||
DOWNLOAD_PROGRESS = "tauri://update-download-progress" | ||
} | ||
/** | ||
* Listen to an event from the backend. | ||
@@ -18,4 +42,6 @@ * | ||
* @param handler Event handler callback. | ||
* @return A promise resolving to a function to unlisten to the event. | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -34,3 +60,3 @@ declare function listen<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>; | ||
* const unlisten = await once<LoadedPayload>('loaded', (event) => { | ||
* console.log(`App is loaded, logggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); | ||
* console.log(`App is loaded, loggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); | ||
* }); | ||
@@ -43,5 +69,6 @@ * | ||
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. | ||
* @param handler Event handler callback. | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -58,7 +85,7 @@ declare function once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>; | ||
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. | ||
* @param [payload] Event payload | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function emit(event: string, payload?: unknown): Promise<void>; | ||
export type { Event, EventName, EventCallback, UnlistenFn }; | ||
export type { Event, EventCallback, UnlistenFn }; | ||
export { listen, once, emit }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./event-aba177ae.js";export{a as emit,l as listen,o as once}from"./event-1823ec51.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";export{T as TauriEvent,a as emit,l as listen,o as once}from"./event-86d4e8b3.js";import"./tauri-3d655ecc.js";import"./tauri-a4b3335a.js"; |
90
fs.d.ts
@@ -0,1 +1,4 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare enum BaseDirectory { | ||
@@ -23,5 +26,11 @@ Audio = 1, | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface FsOptions { | ||
dir?: BaseDirectory; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface FsDirOptions { | ||
@@ -31,3 +40,7 @@ dir?: BaseDirectory; | ||
} | ||
/** Options object used to write a UTF-8 string to a file. */ | ||
/** | ||
* Options object used to write a UTF-8 string to a file. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface FsTextFileOption { | ||
@@ -40,3 +53,7 @@ /** Path to the file to write. */ | ||
declare type BinaryFileContents = Iterable<number> | ArrayLike<number> | ArrayBuffer; | ||
/** Options object used to write a binary data to a file. */ | ||
/** | ||
* Options object used to write a binary data to a file. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface FsBinaryFileOption { | ||
@@ -48,2 +65,5 @@ /** Path to the file to write. */ | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface FileEntry { | ||
@@ -68,5 +88,3 @@ path: string; | ||
* | ||
* @param filePath Path to the file. | ||
* @param options Configuration object. | ||
* @returns A promise resolving to the file content as a UTF-8 encoded string. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -83,5 +101,3 @@ declare function readTextFile(filePath: string, options?: FsOptions): Promise<string>; | ||
* | ||
* @param filePath Path to the file. | ||
* @param options Configuration object. | ||
* @returns A promise resolving to the file bytes array. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -98,6 +114,3 @@ declare function readBinaryFile(filePath: string, options?: FsOptions): Promise<Uint8Array>; | ||
* | ||
* @param path The file path. | ||
* @param contents The file contents. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -113,6 +126,5 @@ declare function writeTextFile(path: string, contents: string, options?: FsOptions): Promise<void>; | ||
* ``` | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @param file The object containing the file path and contents. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -129,6 +141,6 @@ declare function writeTextFile(file: FsTextFileOption, options?: FsOptions): Promise<void>; | ||
* | ||
* @param path The file path. | ||
* @param contents The file contents. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -148,2 +160,4 @@ declare function writeBinaryFile(path: string, contents: BinaryFileContents, options?: FsOptions): Promise<void>; | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -169,5 +183,3 @@ declare function writeBinaryFile(file: FsBinaryFileOption, options?: FsOptions): Promise<void>; | ||
* | ||
* @param dir Path to the directory to read. | ||
* @param options Configuration object. | ||
* @returns A promise resolving to the directory entries. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -186,5 +198,5 @@ declare function readDir(dir: string, options?: FsDirOptions): Promise<FileEntry[]>; | ||
* | ||
* @param dir Path to the directory to create. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -202,9 +214,9 @@ declare function createDir(dir: string, options?: FsDirOptions): Promise<void>; | ||
* | ||
* @param dir Path to the directory to remove. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function removeDir(dir: string, options?: FsDirOptions): Promise<void>; | ||
/** | ||
* Copys a file to a destination. | ||
* Copies a file to a destination. | ||
* @example | ||
@@ -217,6 +229,5 @@ * ```typescript | ||
* | ||
* @param source A path of the file to copy. | ||
* @param destination A path for the destination file. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -233,5 +244,5 @@ declare function copyFile(source: string, destination: string, options?: FsOptions): Promise<void>; | ||
* | ||
* @param file Path to the file to remove. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -248,9 +259,20 @@ declare function removeFile(file: string, options?: FsOptions): Promise<void>; | ||
* | ||
* @param oldPath A path of the file to rename. | ||
* @param newPath A path of the new file name. | ||
* @param options Configuration object. | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function renameFile(oldPath: string, newPath: string, options?: FsOptions): Promise<void>; | ||
/** | ||
* Check if a path exists. | ||
* @example | ||
* ```typescript | ||
* import { exists, BaseDirectory } from '@tauri-apps/api/fs'; | ||
* // Check if the `$APPDIR/avatar.png` file exists | ||
* await exists('avatar.png', { dir: BaseDirectory.App }); | ||
* ``` | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
declare function exists(path: string, options?: FsOptions): Promise<void>; | ||
export type { FsOptions, FsDirOptions, FsTextFileOption, BinaryFileContents, FsBinaryFileOption, FileEntry }; | ||
export { BaseDirectory as Dir, readTextFile, readBinaryFile, writeTextFile, writeTextFile as writeFile, writeBinaryFile, readDir, createDir, removeDir, copyFile, removeFile, renameFile }; | ||
export { BaseDirectory as Dir, readTextFile, readBinaryFile, writeTextFile, writeTextFile as writeFile, writeBinaryFile, readDir, createDir, removeDir, copyFile, removeFile, renameFile, exists }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as BaseDirectory,B as Dir,g as copyFile,d as createDir,a as readBinaryFile,c as readDir,r as readTextFile,e as removeDir,h as removeFile,i as renameFile,b as writeBinaryFile,w as writeFile,w as writeTextFile}from"./fs-c8f11a6d.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{B as BaseDirectory,B as Dir,g as copyFile,d as createDir,j as exists,a as readBinaryFile,c as readDir,r as readTextFile,e as removeDir,h as removeFile,i as renameFile,b as writeBinaryFile,w as writeFile,w as writeTextFile}from"./fs-ff088717.js";import"./tauri-a4b3335a.js"; |
@@ -14,3 +14,4 @@ export declare type ShortcutHandler = (shortcut: string) => void; | ||
* @param handler Shortcut handler callback - takes the triggered shortcut as argument | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -30,3 +31,4 @@ declare function register(shortcut: string, handler: ShortcutHandler): Promise<void>; | ||
* @param handler Shortcut handler callback - takes the triggered shortcut as argument | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -43,3 +45,4 @@ declare function registerAll(shortcuts: string[], handler: ShortcutHandler): Promise<void>; | ||
* @param shortcut Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q | ||
* @returns A promise resolving to the state. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -56,3 +59,4 @@ declare function isRegistered(shortcut: string): Promise<boolean>; | ||
* @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -68,5 +72,5 @@ declare function unregister(shortcut: string): Promise<void>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
declare function unregisterAll(): Promise<void>; | ||
export { register, registerAll, isRegistered, unregister, unregisterAll }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";export{i as isRegistered,r as register,a as registerAll,u as unregister,b as unregisterAll}from"./globalShortcut-37a16ba5.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";import"./tauri-a4b3335a.js";export{i as isRegistered,r as register,a as registerAll,u as unregister,b as unregisterAll}from"./globalShortcut-4a985527.js"; |
import { WindowLabel } from '../window'; | ||
import type { EventName } from '../event'; | ||
export interface Event<T> { | ||
@@ -12,3 +13,2 @@ /** Event name */ | ||
} | ||
export declare type EventName = string; | ||
export declare type EventCallback<T> = (event: Event<T>) => void; | ||
@@ -15,0 +15,0 @@ export declare type UnlistenFn = () => void; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface Duration { | ||
@@ -5,6 +8,16 @@ secs: number; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface ClientOptions { | ||
maxRedirections?: number; | ||
/** | ||
* Defines the maximum number of redirects the client should follow. | ||
* If set to 0, no redirects will be followed. | ||
*/ | ||
connectTimeout?: number | Duration; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
declare enum ResponseType { | ||
@@ -15,2 +28,5 @@ JSON = 1, | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface FilePart<T> { | ||
@@ -22,3 +38,7 @@ file: string | T; | ||
declare type Part = string | Uint8Array | FilePart<Uint8Array>; | ||
/** The body object to be used on POST and PUT requests. */ | ||
/** | ||
* The body object to be used on POST and PUT requests. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare class Body { | ||
@@ -52,3 +72,3 @@ type: string; | ||
* | ||
* @return The body object ready to be used on the POST and PUT requests. | ||
* @returns The body object ready to be used on the POST and PUT requests. | ||
*/ | ||
@@ -69,3 +89,3 @@ static form(data: Record<string, Part>): Body; | ||
* | ||
* @return The body object ready to be used on the POST and PUT requests. | ||
* @returns The body object ready to be used on the POST and PUT requests. | ||
*/ | ||
@@ -81,5 +101,5 @@ static json(data: Record<any, any>): Body; | ||
* | ||
* @param data The body string. | ||
* @param value The body string. | ||
* | ||
* @return The body object ready to be used on the POST and PUT requests. | ||
* @returns The body object ready to be used on the POST and PUT requests. | ||
*/ | ||
@@ -95,5 +115,5 @@ static text(value: string): Body; | ||
* | ||
* @param data The body byte array. | ||
* @param bytes The body byte array. | ||
* | ||
* @return The body object ready to be used on the POST and PUT requests. | ||
* @returns The body object ready to be used on the POST and PUT requests. | ||
*/ | ||
@@ -104,3 +124,7 @@ static bytes(bytes: Iterable<number> | ArrayLike<number> | ArrayBuffer): Body; | ||
declare type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE'; | ||
/** Options object sent to the backend. */ | ||
/** | ||
* Options object sent to the backend. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface HttpOptions { | ||
@@ -127,3 +151,7 @@ method: HttpVerb; | ||
} | ||
/** Response object. */ | ||
/** | ||
* Response object. | ||
* | ||
* @since 1.0.0 | ||
* */ | ||
declare class Response<T> { | ||
@@ -145,2 +173,5 @@ /** The request URL. */ | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
declare class Client { | ||
@@ -158,4 +189,2 @@ id: number; | ||
* ``` | ||
* | ||
* @returns | ||
*/ | ||
@@ -174,5 +203,2 @@ drop(): Promise<void>; | ||
* ``` | ||
* | ||
* @param options The request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -192,6 +218,2 @@ request<T>(options: HttpOptions): Promise<Response<T>>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param options The request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -214,7 +236,2 @@ get<T>(url: string, options?: RequestOptions): Promise<Response<T>>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param body The body of the request. | ||
* @param options The request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -238,7 +255,2 @@ post<T>(url: string, body?: Body, options?: RequestOptions): Promise<Response<T>>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param body The body of the request. | ||
* @param options Request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -256,6 +268,2 @@ put<T>(url: string, body?: Body, options?: RequestOptions): Promise<Response<T>>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param options The request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -271,6 +279,2 @@ patch<T>(url: string, options?: RequestOptions): Promise<Response<T>>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param options The request options. | ||
* @returns A promise resolving to the response. | ||
*/ | ||
@@ -289,3 +293,5 @@ delete<T>(url: string, options?: RequestOptions): Promise<Response<T>>; | ||
* | ||
* @return A promise resolving to the client instance. | ||
* @returns A promise resolving to the client instance. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -303,6 +309,2 @@ declare function getClient(options?: ClientOptions): Promise<Client>; | ||
* ``` | ||
* | ||
* @param url The request URL. | ||
* @param options The fetch options. | ||
* @return The response object. | ||
*/ | ||
@@ -309,0 +311,0 @@ declare function fetch<T>(url: string, options?: FetchOptions): Promise<Response<T>>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as Body,C as Client,R as Response,a as ResponseType,f as fetch,g as getClient}from"./http-db5e353e.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{B as Body,C as Client,R as Response,a as ResponseType,f as fetch,g as getClient}from"./http-58a1c419.js";import"./tauri-a4b3335a.js"; |
@@ -1,1 +0,1 @@ | ||
import{i as t}from"./tauri-fa8f44bd.js";export{a as tauri}from"./tauri-fa8f44bd.js";export{f as fs}from"./fs-c8f11a6d.js";export{h as http}from"./http-db5e353e.js";export{p as path}from"./path-9581ef45.js";export{s as shell}from"./shell-0d054540.js";export{w as window}from"./window-5b72c451.js";export{o as os}from"./os-568baf9e.js";export{a as app}from"./app-ea395091.js";export{c as cli}from"./cli-0a14b129.js";export{c as clipboard}from"./clipboard-6ac7f168.js";export{d as dialog}from"./dialog-37b7acba.js";export{e as event}from"./event-1823ec51.js";export{g as globalShortcut}from"./globalShortcut-37a16ba5.js";export{n as notification}from"./notification-1da296a1.js";export{p as process}from"./process-67cf9ac3.js";export{u as updater}from"./updater-235abf4a.js";import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./os-check-094ffe86.js";import"./event-aba177ae.js";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t){var e=function(t){var e,o=Object.prototype,n=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function f(t,r,e,o){var n=r&&r.prototype instanceof v?r:v,i=Object.create(n.prototype),a=new G(o||[]);return i._invoke=function(t,r,e){var o=l;return function(n,i){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===n)throw i;return T()}for(e.method=n,e.arg=i;;){var a=e.delegate;if(a){var c=S(a,e);if(c){if(c===m)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(o===l)throw o=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);o=y;var u=h(t,r,e);if("normal"===u.type){if(o=e.done?d:p,u.arg===m)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(o=d,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var l="suspendedStart",p="suspendedYield",y="executing",d="completed",m={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(N([])));j&&j!==o&&n.call(j,a)&&(w=j);var L=b.prototype=v.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,e){function o(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"===r(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function S(t,r){var o=t.iterator[r.method];if(o===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var n=h(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;var i=n.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:e,done:!0}}return g.prototype=b,s(L,"constructor",b),s(b,"constructor",g),g.displayName=s(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(r,e,o,n,i){void 0===i&&(i=Promise);var a=new _(f(r,e,o,n),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),s(L,u,"Generator"),s(L,a,(function(){return this})),s(L,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(o,n){return c.type="throw",c.arg=t,r.next=o,n&&(r.method="next",r.arg=e),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var o=e.completion;if("throw"===o.type){var n=o.arg;k(e)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,o){return this.delegate={iterator:N(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}({exports:{}});var i=t;export{i as invoke}; | ||
import{i as t}from"./tauri-a4b3335a.js";export{a as tauri}from"./tauri-a4b3335a.js";export{e as event}from"./event-86d4e8b3.js";export{f as fs}from"./fs-ff088717.js";export{h as http}from"./http-58a1c419.js";export{p as path}from"./path-5af4eed5.js";export{s as shell}from"./shell-e5849d56.js";export{w as window}from"./window-25493f72.js";export{o as os}from"./os-31a780fa.js";export{a as app}from"./app-e71555b6.js";export{c as cli}from"./cli-152ced64.js";export{c as clipboard}from"./clipboard-4edc6511.js";export{d as dialog}from"./dialog-5c2a33bf.js";export{g as globalShortcut}from"./globalShortcut-4a985527.js";export{n as notification}from"./notification-94d5c62f.js";export{p as process}from"./process-a29f5989.js";export{u as updater}from"./updater-204de9e4.js";import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";import"./os-check-27fe6e2b.js";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}!function(t){var e=function(t){var e,o=Object.prototype,n=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function f(t,r,e,o){var n=r&&r.prototype instanceof v?r:v,i=Object.create(n.prototype),a=new G(o||[]);return i._invoke=function(t,r,e){var o=l;return function(n,i){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===n)throw i;return T()}for(e.method=n,e.arg=i;;){var a=e.delegate;if(a){var c=S(a,e);if(c){if(c===m)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(o===l)throw o=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);o=y;var u=h(t,r,e);if("normal"===u.type){if(o=e.done?d:p,u.arg===m)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(o=d,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var l="suspendedStart",p="suspendedYield",y="executing",d="completed",m={};function v(){}function g(){}function w(){}var b={};s(b,a,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(N([])));j&&j!==o&&n.call(j,a)&&(b=j);var L=w.prototype=v.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,e){function o(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"===r(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function S(t,r){var o=t.iterator[r.method];if(o===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var n=h(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;var i=n.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:e,done:!0}}return g.prototype=w,s(L,"constructor",w),s(w,"constructor",g),g.displayName=s(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,s(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(_.prototype),s(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(r,e,o,n,i){void 0===i&&(i=Promise);var a=new _(f(r,e,o,n),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),s(L,u,"Generator"),s(L,a,(function(){return this})),s(L,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(o,n){return c.type="throw",c.arg=t,r.next=o,n&&(r.method="next",r.arg=e),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var o=e.completion;if("throw"===o.type){var n=o.arg;k(e)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,o){return this.delegate={iterator:N(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}({exports:{}});var i=t;export{i as invoke}; |
@@ -31,5 +31,26 @@ /** | ||
* | ||
* @param cb | ||
* The callback function can also return a Promise: | ||
* ```js | ||
* import { mockIPC, clearMocks } from "@tauri-apps/api/mocks" | ||
* import { invoke } from "@tauri-apps/api/tauri" | ||
* | ||
* afterEach(() => { | ||
* clearMocks() | ||
* }) | ||
* | ||
* test("mocked command", () => { | ||
* mockIPC((cmd, args) => { | ||
* if(cmd === "get_data") { | ||
* return fetch("https://example.com/data.json") | ||
* .then((response) => response.json()) | ||
* } | ||
* }); | ||
* | ||
* expect(invoke('get_data')).resolves.toBe({ foo: 'bar' }); | ||
* }) | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
export declare function mockIPC(cb: (cmd: string, args: Record<string, unknown>) => any): void; | ||
export declare function mockIPC(cb: (cmd: string, args: Record<string, unknown>) => any | Promise<any>): void; | ||
/** | ||
@@ -80,2 +101,4 @@ * Mocks one or many window labels. | ||
* @param additionalWindows Label of additional windows the app has. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -106,3 +129,5 @@ export declare function mockWindows(current: string, ...additionalWindows: string[]): void; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
export declare function clearMocks(): void; |
/** | ||
* Options to send a notification. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -22,3 +24,3 @@ interface Options { | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -39,2 +41,4 @@ declare function isPermissionGranted(): Promise<boolean>; | ||
* @returns A promise resolving to whether the user granted the permission or not. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -58,3 +62,3 @@ declare function requestPermission(): Promise<Permission>; | ||
* | ||
* @param options Notification options. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -61,0 +65,0 @@ declare function sendNotification(options: Options | string): void; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{i as isPermissionGranted,r as requestPermission,s as sendNotification}from"./notification-1da296a1.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{i as isPermissionGranted,r as requestPermission,s as sendNotification}from"./notification-94d5c62f.js";import"./tauri-a4b3335a.js"; |
13
os.d.ts
@@ -8,2 +8,4 @@ declare type Platform = 'linux' | 'darwin' | 'ios' | 'freebsd' | 'dragonfly' | 'netbsd' | 'openbsd' | 'solaris' | 'android' | 'win32'; | ||
* - `\r\n` on Windows | ||
* | ||
* @since 1.0.0 | ||
* */ | ||
@@ -19,2 +21,5 @@ declare const EOL: string; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
* | ||
*/ | ||
@@ -29,2 +34,4 @@ declare function platform(): Promise<Platform>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -39,2 +46,4 @@ declare function version(): Promise<string>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -50,2 +59,4 @@ declare function type(): Promise<OsType>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -60,2 +71,4 @@ declare function arch(): Promise<Arch>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -62,0 +75,0 @@ declare function tempdir(): Promise<string>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./os-check-094ffe86.js";import"./tauri-7cafdaf8.js";export{E as EOL,a as arch,p as platform,b as tempdir,t as type,v as version}from"./os-568baf9e.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./os-check-27fe6e2b.js";import"./tauri-3d655ecc.js";export{E as EOL,a as arch,p as platform,b as tempdir,t as type,v as version}from"./os-31a780fa.js";import"./tauri-a4b3335a.js"; |
{ | ||
"name": "@tauri-apps/api", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Tauri API definitions", | ||
@@ -120,18 +120,19 @@ "type": "module", | ||
"devDependencies": { | ||
"@babel/core": "7.18.6", | ||
"@babel/preset-env": "7.18.6", | ||
"@babel/core": "7.19.0", | ||
"@babel/preset-env": "7.19.0", | ||
"@babel/preset-typescript": "7.18.6", | ||
"@rollup/plugin-babel": "5.3.1", | ||
"@rollup/plugin-commonjs": "22.0.1", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@rollup/plugin-sucrase": "4.0.4", | ||
"@rollup/plugin-typescript": "8.3.3", | ||
"@typescript-eslint/eslint-plugin": "5.30.5", | ||
"@typescript-eslint/parser": "5.30.5", | ||
"eslint": "8.19.0", | ||
"@rollup/plugin-typescript": "8.5.0", | ||
"@typescript-eslint/eslint-plugin": "5.36.2", | ||
"@typescript-eslint/parser": "5.36.2", | ||
"eslint": "8.23.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-config-standard-with-typescript": "21.0.1", | ||
"eslint-config-standard-with-typescript": "22.0.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-n": "15.2.5", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-promise": "6.0.0", | ||
"eslint-plugin-promise": "6.0.1", | ||
"eslint-plugin-security": "1.5.0", | ||
@@ -141,9 +142,10 @@ "prettier": "2.7.1", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.75.7", | ||
"rollup": "2.79.0", | ||
"rollup-plugin-terser": "7.0.2", | ||
"tslib": "2.4.0", | ||
"typedoc": "0.23.5", | ||
"typedoc-plugin-markdown": "3.13.3", | ||
"typescript": "4.7.4" | ||
"typedoc": "0.23.14", | ||
"typedoc-plugin-markdown": "3.13.6", | ||
"typedoc-plugin-mdn-links": "^2.0.0", | ||
"typescript": "4.8.2" | ||
} | ||
} |
import { BaseDirectory } from './fs'; | ||
/** | ||
* Returns the path to the suggested directory for your app config files. | ||
* Resolves to `${configDir}/${bundleIdentifier}`, where `bundleIdentifier` is the value configured on `tauri.conf.json > tauri > bundle > identifier`. | ||
* 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`. | ||
* @example | ||
@@ -11,3 +11,3 @@ * ```typescript | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -29,3 +29,3 @@ declare function appDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -47,3 +47,3 @@ declare function audioDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -65,3 +65,3 @@ declare function cacheDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -83,3 +83,3 @@ declare function configDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -100,4 +100,4 @@ declare function dataDir(): Promise<string>; | ||
* ``` | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -119,3 +119,3 @@ declare function desktopDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -137,3 +137,3 @@ declare function documentDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -155,3 +155,3 @@ declare function downloadDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -173,3 +173,3 @@ declare function executableDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -191,3 +191,3 @@ declare function fontDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -209,3 +209,3 @@ declare function homeDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -227,3 +227,3 @@ declare function localDataDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -245,3 +245,3 @@ declare function pictureDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -258,3 +258,3 @@ declare function publicDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -273,2 +273,4 @@ declare function resourceDir(): Promise<string>; | ||
* @returns The full path to the resource. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -290,3 +292,3 @@ declare function resolveResource(resourcePath: string): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -308,3 +310,3 @@ declare function runtimeDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -326,3 +328,3 @@ declare function templateDir(): Promise<string>; | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -333,3 +335,3 @@ declare function videoDir(): Promise<string>; | ||
* | ||
* ### Platform-specific | ||
* #### Platform-specific | ||
* | ||
@@ -345,3 +347,3 @@ * - **Linux:** Resolves to `${configDir}/${bundleIdentifier}`. | ||
* | ||
* @returns | ||
* @since 1.0.0 | ||
*/ | ||
@@ -353,2 +355,4 @@ declare function logDir(): Promise<string>; | ||
* - `/` on POSIX | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -360,2 +364,4 @@ declare const sep: string; | ||
* - `:` on POSIX | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -372,7 +378,7 @@ declare const delimiter: string; | ||
* | ||
* @param paths A sequence of paths or path segments. | ||
* @since 1.0.0 | ||
*/ | ||
declare function resolve(...paths: string[]): Promise<string>; | ||
/** | ||
* Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symolic links. | ||
* Normalizes the given `path`, resolving `'..'` and `'.'` segments and resolve symbolic links. | ||
* @example | ||
@@ -384,2 +390,4 @@ * ```typescript | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -396,3 +404,3 @@ declare function normalize(path: string): Promise<string>; | ||
* | ||
* @param paths A sequence of path segments. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -408,2 +416,4 @@ declare function join(...paths: string[]): Promise<string>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -420,2 +430,4 @@ declare function dirname(path: string): Promise<string>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -434,2 +446,4 @@ declare function extname(path: string): Promise<string>; | ||
* @param ext An optional file extension to be removed from the returned path. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -444,4 +458,6 @@ declare function basename(path: string, ext?: string): Promise<string>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function isAbsolute(path: string): Promise<boolean>; | ||
export { appDir, audioDir, cacheDir, configDir, dataDir, desktopDir, documentDir, downloadDir, executableDir, fontDir, homeDir, localDataDir, pictureDir, publicDir, resourceDir, resolveResource, runtimeDir, templateDir, videoDir, logDir, BaseDirectory, sep, delimiter, resolve, normalize, join, dirname, extname, basename, isAbsolute }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{B as BaseDirectory}from"./fs-c8f11a6d.js";import"./os-check-094ffe86.js";export{a as appDir,b as audioDir,C as basename,c as cacheDir,d as configDir,e as dataDir,w as delimiter,f as desktopDir,A as dirname,g as documentDir,h as downloadDir,i as executableDir,B as extname,j as fontDir,k as homeDir,D as isAbsolute,z as join,l as localDataDir,s as logDir,y as normalize,m as pictureDir,n as publicDir,x as resolve,o as resolveResource,r as resourceDir,q as runtimeDir,u as sep,t as templateDir,v as videoDir}from"./path-9581ef45.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{B as BaseDirectory}from"./fs-ff088717.js";import"./os-check-27fe6e2b.js";export{a as appDir,b as audioDir,C as basename,c as cacheDir,d as configDir,e as dataDir,w as delimiter,f as desktopDir,A as dirname,g as documentDir,h as downloadDir,i as executableDir,B as extname,j as fontDir,k as homeDir,D as isAbsolute,z as join,l as localDataDir,s as logDir,y as normalize,m as pictureDir,n as publicDir,x as resolve,o as resolveResource,r as resourceDir,q as runtimeDir,u as sep,t as templateDir,v as videoDir}from"./path-5af4eed5.js";import"./tauri-a4b3335a.js"; |
@@ -11,2 +11,4 @@ /** | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -23,4 +25,6 @@ declare function exit(exitCode?: number): Promise<void>; | ||
* @returns A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function relaunch(): Promise<void>; | ||
export { exit, relaunch }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";export{e as exit,r as relaunch}from"./process-67cf9ac3.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";export{e as exit,r as relaunch}from"./process-a29f5989.js";import"./tauri-a4b3335a.js"; |
@@ -5,11 +5,10 @@ # @tauri-apps/api | ||
[![status](https://img.shields.io/badge/Status-Stable-green.svg)](https://github.com/tauri-apps/tauri) | ||
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S) | ||
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri) | ||
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library) | ||
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app) | ||
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev) | ||
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri) | ||
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22) | ||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield) | ||
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S) | ||
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app) | ||
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation) | ||
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri) | ||
[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri) | ||
@@ -28,3 +27,3 @@ | Component | Version | | ||
This is a typescript library that creates `cjs` and `esm` Javascript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure typescript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts. | ||
This is a typescript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure typescript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts. | ||
@@ -31,0 +30,0 @@ To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document. |
123
shell.d.ts
@@ -0,1 +1,4 @@ | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface SpawnOptions { | ||
@@ -8,3 +11,12 @@ /** Current working directory. */ | ||
}; | ||
/** | ||
* Character encoding for stdout/stderr | ||
* | ||
* @since 1.1.0 | ||
* */ | ||
encoding?: string; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface ChildProcess { | ||
@@ -20,19 +32,93 @@ /** Exit code of the process. `null` if the process was terminated by a signal on Unix. */ | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
declare class EventEmitter<E extends string> { | ||
/** @ignore */ | ||
/** @ignore */ | ||
private eventListeners; | ||
/** @ignore */ | ||
private addEventListener; | ||
/** @ignore */ | ||
_emit(event: E, payload: any): void; | ||
/** | ||
* Listen to an event from the child process. | ||
* Alias for `emitter.on(eventName, listener)`. | ||
* | ||
* @param event The event name. | ||
* @param handler The event handler. | ||
* @since 1.1.0 | ||
*/ | ||
addListener(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Alias for `emitter.off(eventName, listener)`. | ||
* | ||
* @return The `this` instance for chained calls. | ||
* @since 1.1.0 | ||
*/ | ||
on(event: E, handler: (arg: any) => void): EventEmitter<E>; | ||
removeListener(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Adds the `listener` function to the end of the listeners array for the | ||
* event named `eventName`. No checks are made to see if the `listener` has | ||
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple | ||
* times. | ||
* | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
on(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Adds a **one-time**`listener` function for the event named `eventName`. The | ||
* next time `eventName` is triggered, this listener is removed and then invoked. | ||
* | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
once(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Removes the all specified listener from the listener array for the event eventName | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
off(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Removes all listeners, or those of the specified eventName. | ||
* | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
removeAllListeners(event?: E): this; | ||
/** | ||
* @ignore | ||
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments | ||
* to each. | ||
* | ||
* @returns `true` if the event had listeners, `false` otherwise. | ||
*/ | ||
emit(eventName: E, ...args: any[]): boolean; | ||
/** | ||
* Returns the number of listeners listening to the event named `eventName`. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
listenerCount(eventName: E): number; | ||
/** | ||
* Adds the `listener` function to the _beginning_ of the listeners array for the | ||
* event named `eventName`. No checks are made to see if the `listener` has | ||
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple | ||
* times. | ||
* | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
prependListener(eventName: E, listener: (...args: any[]) => void): this; | ||
/** | ||
* Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this | ||
* listener is removed, and then invoked. | ||
* | ||
* Returns a reference to the `EventEmitter`, so that calls can be chained. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
prependOnceListener(eventName: E, listener: (...args: any[]) => void): this; | ||
} | ||
/** | ||
* @since 1.1.0 | ||
*/ | ||
declare class Child { | ||
@@ -55,3 +141,3 @@ /** The child process `pid`. */ | ||
* | ||
* @return A promise indicating the success or failure of the operation. | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
@@ -62,3 +148,3 @@ write(data: string | Uint8Array): Promise<void>; | ||
* | ||
* @return A promise indicating the success or failure of the operation. | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
@@ -84,2 +170,5 @@ kill(): Promise<void>; | ||
* ``` | ||
* | ||
* @since 1.1.0 | ||
* | ||
*/ | ||
@@ -117,5 +206,2 @@ declare class Command extends EventEmitter<'close' | 'error'> { | ||
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`. | ||
* @param args Program arguments. | ||
* @param options Spawn options. | ||
* @returns | ||
*/ | ||
@@ -126,3 +212,3 @@ static sidecar(program: string, args?: string | string[], options?: SpawnOptions): Command; | ||
* | ||
* @return A promise resolving to the child process handle. | ||
* @returns A promise resolving to the child process handle. | ||
*/ | ||
@@ -142,3 +228,3 @@ spawn(): Promise<Child>; | ||
* | ||
* @return A promise resolving to the child process output. | ||
* @returns A promise resolving to the child process output. | ||
*/ | ||
@@ -170,3 +256,4 @@ execute(): Promise<ChildProcess>; | ||
* Defaults to the system default application for the specified path type. | ||
* @returns | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -173,0 +260,0 @@ declare function open(path: string, openWith?: string): Promise<void>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js";export{a as Child,C as Command,E as EventEmitter,o as open}from"./shell-0d054540.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";import"./tauri-a4b3335a.js";export{a as Child,C as Command,E as EventEmitter,o as open}from"./shell-e5849d56.js"; |
/** | ||
* Invoke your custom commands. | ||
* | ||
* This package is also accessible with `window.__TAURI__.tauri` when `tauri.conf.json > build > withGlobalTauri` is set to true. | ||
* This package is also accessible with `window.__TAURI__.tauri` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`. | ||
* @module | ||
@@ -21,5 +21,11 @@ */ | ||
* @return A unique identifier associated with the callback function. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function transformCallback(callback?: (response: any) => void, once?: boolean): number; | ||
/** Command arguments. */ | ||
/** | ||
* Command arguments. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface InvokeArgs { | ||
@@ -39,2 +45,4 @@ [key: string]: unknown; | ||
* @return A promise resolving or rejecting to the backend response. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -44,7 +52,7 @@ declare function invoke<T>(cmd: string, args?: InvokeArgs): Promise<T>; | ||
* Convert a device file path to an URL that can be loaded by the webview. | ||
* Note that `asset:` and `https://asset.localhost` must be allowed on the `csp` value configured on `tauri.conf.json > tauri > security`. | ||
* 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. | ||
* | ||
* Additionally, the `asset` must be allowlisted under `tauri.conf.json > tauri > allowlist > protocol`, | ||
* and its access scope must be defined on the `assetScope` array on the same `protocol` object. | ||
* 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. | ||
* | ||
@@ -70,2 +78,4 @@ * @param filePath The file path. | ||
* @return the URL that can be used as source on the webview. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -72,0 +82,0 @@ declare function convertFileSrc(filePath: string, protocol?: string): string; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";export{c as convertFileSrc,i as invoke,t as transformCallback}from"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";export{c as convertFileSrc,i as invoke,t as transformCallback}from"./tauri-a4b3335a.js"; |
@@ -1,1 +0,1 @@ | ||
var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var r=function(){return(r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};function e(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]])}return r}function o(t,n,r,e){return new(r||(r=Promise))((function(o,a){function c(t){try{i(e.next(t))}catch(t){a(t)}}function l(t){try{i(e.throw(t))}catch(t){a(t)}}function i(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(c,l)}i((e=e.apply(t,n||[])).next())}))}function a(t,n){var r,e,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,e&&(o=2&a[0]?e.return:a[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,a[1])).done)return o;switch(e=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,e=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=n.call(t,c)}catch(t){a=[6,t],e=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function c(t,n,r){if(r||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}export{o as _,a,r as b,n as c,e as d,c as e}; | ||
var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function e(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]])}return r}function o(t,n,r,e){return new(r||(r=Promise))((function(o,a){function c(t){try{i(e.next(t))}catch(t){a(t)}}function l(t){try{i(e.throw(t))}catch(t){a(t)}}function i(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(c,l)}i((e=e.apply(t,n||[])).next())}))}function a(t,n){var r,e,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,e&&(o=2&a[0]?e.return:a[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,a[1])).done)return o;switch(e=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,e=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=n.call(t,c)}catch(t){a=[6,t],e=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function c(t,n,r){if(r||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}export{o as _,a,r as b,n as c,e as d,c as e}; |
/** | ||
* Customize the auto updater flow. | ||
* | ||
* This package is also accessible with `window.__TAURI__.updater` when `tauri.conf.json > build > withGlobalTauri` is set to true. | ||
* This package is also accessible with `window.__TAURI__.updater` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`. | ||
* @module | ||
*/ | ||
import { UnlistenFn } from './event'; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
declare type UpdateStatus = 'PENDING' | 'ERROR' | 'DONE' | 'UPTODATE'; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface UpdateStatusResult { | ||
@@ -13,2 +19,5 @@ error?: string; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface UpdateManifest { | ||
@@ -19,2 +28,5 @@ version: string; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
interface UpdateResult { | ||
@@ -37,5 +49,6 @@ manifest?: UpdateManifest; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -56,2 +69,4 @@ declare function onUpdaterEvent(handler: (status: UpdateStatusResult) => void): Promise<UnlistenFn>; | ||
* @return A promise indicating the success or failure of the operation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -69,2 +84,4 @@ declare function installUpdate(): Promise<void>; | ||
* @return Promise resolving to the update status. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -71,0 +88,0 @@ declare function checkUpdate(): Promise<UpdateResult>; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./event-1823ec51.js";export{c as checkUpdate,i as installUpdate,o as onUpdaterEvent}from"./updater-235abf4a.js";import"./event-aba177ae.js";import"./tauri-7cafdaf8.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./event-86d4e8b3.js";export{c as checkUpdate,i as installUpdate,o as onUpdaterEvent}from"./updater-204de9e4.js";import"./tauri-3d655ecc.js";import"./tauri-a4b3335a.js"; |
import type { EventName, EventCallback, UnlistenFn } from './event'; | ||
import { Event } from './helpers/event'; | ||
declare type Theme = 'light' | 'dark'; | ||
/** Allows you to retrieve information about a given monitor. */ | ||
/** | ||
* Allows you to retrieve information about a given monitor. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface Monitor { | ||
@@ -15,3 +19,7 @@ /** Human-readable name of the monitor */ | ||
} | ||
/** The payload for the `scaleChange` event. */ | ||
/** | ||
* The payload for the `scaleChange` event. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
interface ScaleFactorChanged { | ||
@@ -33,3 +41,7 @@ /** The new window scale factor. */ | ||
}; | ||
/** A size represented in logical pixels. */ | ||
/** | ||
* A size represented in logical pixels. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare class LogicalSize { | ||
@@ -41,3 +53,7 @@ type: string; | ||
} | ||
/** A size represented in physical pixels. */ | ||
/** | ||
* A size represented in physical pixels. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare class PhysicalSize { | ||
@@ -60,3 +76,7 @@ type: string; | ||
} | ||
/** A position represented in logical pixels. */ | ||
/** | ||
* A position represented in logical pixels. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare class LogicalPosition { | ||
@@ -68,3 +88,7 @@ type: string; | ||
} | ||
/** A position represented in physical pixels. */ | ||
/** | ||
* A position represented in physical pixels. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare class PhysicalPosition { | ||
@@ -100,7 +124,11 @@ type: string; | ||
} | ||
/** Attention type to request on a window. */ | ||
/** | ||
* Attention type to request on a window. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare enum UserAttentionType { | ||
/** | ||
* #### Platform-specific | ||
* - **macOS:** Bounces the dock icon until the application is in focus. | ||
* - **macOS:** Bounces the dock icon until the application is in focus. | ||
* - **Windows:** Flashes both the window and the taskbar button until the application is in focus. | ||
@@ -120,9 +148,9 @@ */ | ||
* | ||
* @return The current WebviewWindow. | ||
* @since 1.0.0 | ||
*/ | ||
declare function getCurrent(): WebviewWindow; | ||
/** | ||
* Gets an instance of `WebviewWindow` for all available webview windows. | ||
* Gets a list of instances of `WebviewWindow` for all available webview windows. | ||
* | ||
* @return The list of WebviewWindow. | ||
* @since 1.0.0 | ||
*/ | ||
@@ -134,2 +162,4 @@ declare function getAll(): WebviewWindow[]; | ||
* A webview window handle allows emitting and listening to events from the backend that are tied to the window. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -200,2 +230,4 @@ declare class WebviewWindowHandle { | ||
* Manage the current window object. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -691,5 +723,6 @@ declare class WindowManager extends WebviewWindowHandle { | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -711,5 +744,6 @@ onResized(handler: EventCallback<PhysicalSize>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -736,5 +770,6 @@ onMoved(handler: EventCallback<PhysicalPosition>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -756,5 +791,6 @@ onCloseRequested(handler: (event: CloseRequestedEvent) => void): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -780,5 +816,6 @@ onFocusChanged(handler: EventCallback<boolean>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -800,5 +837,6 @@ onScaleChanged(handler: EventCallback<ScaleFactorChanged>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -828,5 +866,6 @@ onMenuClicked(handler: EventCallback<string>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -848,8 +887,12 @@ onFileDropEvent(handler: EventCallback<FileDropEvent>): Promise<UnlistenFn>; | ||
* | ||
* @param handler | ||
* @returns A promise resolving to a function to unlisten to the event. | ||
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
onThemeChanged(handler: EventCallback<Theme>): Promise<UnlistenFn>; | ||
} | ||
/** | ||
* @since 1.0.2 | ||
*/ | ||
declare class CloseRequestedEvent { | ||
@@ -897,2 +940,4 @@ /** Event name */ | ||
* ``` | ||
* | ||
* @since 1.0.2 | ||
*/ | ||
@@ -935,3 +980,7 @@ declare class WebviewWindow extends WindowManager { | ||
declare let appWindow: WebviewWindow; | ||
/** Configuration for the window to create. */ | ||
/** | ||
* Configuration for the window to create. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
interface WindowOptions { | ||
@@ -1009,2 +1058,4 @@ /** | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -1020,2 +1071,4 @@ declare function currentMonitor(): Promise<Monitor | null>; | ||
* ``` | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@@ -1030,5 +1083,7 @@ declare function primaryMonitor(): Promise<Monitor | null>; | ||
* ``` | ||
* */ | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
declare function availableMonitors(): Promise<Monitor[]>; | ||
export { WebviewWindow, WebviewWindowHandle, WindowManager, CloseRequestedEvent, getCurrent, getAll, appWindow, LogicalSize, PhysicalSize, LogicalPosition, PhysicalPosition, UserAttentionType, currentMonitor, primaryMonitor, availableMonitors }; | ||
export type { Theme, Monitor, ScaleFactorChanged, FileDropEvent, WindowOptions }; |
@@ -1,1 +0,1 @@ | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-7cafdaf8.js";import"./event-aba177ae.js";export{C as CloseRequestedEvent,e as LogicalPosition,L as LogicalSize,f as PhysicalPosition,P as PhysicalSize,U as UserAttentionType,W as WebviewWindow,a as WebviewWindowHandle,b as WindowManager,d as appWindow,i as availableMonitors,h as currentMonitor,c as getAll,g as getCurrent,p as primaryMonitor}from"./window-5b72c451.js";import"./tauri-fa8f44bd.js"; | ||
import"./tslib.es6-9bc0804d.js";import"./tauri-3d655ecc.js";import"./event-86d4e8b3.js";export{C as CloseRequestedEvent,e as LogicalPosition,L as LogicalSize,f as PhysicalPosition,P as PhysicalSize,U as UserAttentionType,W as WebviewWindow,a as WebviewWindowHandle,b as WindowManager,d as appWindow,i as availableMonitors,h as currentMonitor,c as getAll,g as getCurrent,p as primaryMonitor}from"./window-25493f72.js";import"./tauri-a4b3335a.js"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 5 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 5 instances in 1 package
293265
3847
30
28
101
52