@tauri-apps/api
Advanced tools
Comparing version 2.0.0-rc.3 to 2.0.0-rc.4
@@ -40,3 +40,16 @@ /** | ||
declare function addPluginListener<T>(plugin: string, event: string, cb: (payload: T) => void): Promise<PluginListener>; | ||
type PermissionState = 'granted' | 'denied' | 'prompt' | 'prompt-with-rationale'; | ||
/** | ||
* Get permission state for a plugin. | ||
* | ||
* This should be used by plugin authors to wrap their actual implementation. | ||
*/ | ||
declare function checkPermissions<T>(plugin: string): Promise<T>; | ||
/** | ||
* Request permissions. | ||
* | ||
* This should be used by plugin authors to wrap their actual implementation. | ||
*/ | ||
declare function requestPermissions<T>(plugin: string): Promise<T>; | ||
/** | ||
* Command arguments. | ||
@@ -134,2 +147,2 @@ * | ||
export type { InvokeArgs, InvokeOptions }; | ||
export { transformCallback, Channel, PluginListener, addPluginListener, invoke, convertFileSrc, isTauri }; | ||
export { transformCallback, Channel, PluginListener, addPluginListener, PermissionState, checkPermissions, requestPermissions, invoke, convertFileSrc, isTauri }; |
18
core.js
@@ -103,2 +103,18 @@ import { __classPrivateFieldGet, __classPrivateFieldSet } from './external/tslib/tslib.es6.js'; | ||
/** | ||
* Get permission state for a plugin. | ||
* | ||
* This should be used by plugin authors to wrap their actual implementation. | ||
*/ | ||
async function checkPermissions(plugin) { | ||
return invoke(`plugin:${plugin}|check_permissions`); | ||
} | ||
/** | ||
* Request permissions. | ||
* | ||
* This should be used by plugin authors to wrap their actual implementation. | ||
*/ | ||
async function requestPermissions(plugin) { | ||
return invoke(`plugin:${plugin}|request_permissions`); | ||
} | ||
/** | ||
* Sends a message to the backend. | ||
@@ -199,2 +215,2 @@ * @example | ||
export { Channel, PluginListener, Resource, addPluginListener, convertFileSrc, invoke, isTauri, transformCallback }; | ||
export { Channel, PluginListener, Resource, addPluginListener, checkPermissions, convertFileSrc, invoke, isTauri, requestPermissions, transformCallback }; |
10
image.js
@@ -79,9 +79,5 @@ import { Resource, invoke } from './core.js'; | ||
? image | ||
: image instanceof Uint8Array | ||
? Array.from(image) | ||
: image instanceof ArrayBuffer | ||
? Array.from(new Uint8Array(image)) | ||
: image instanceof Image | ||
? image.rid | ||
: image; | ||
: image instanceof Image | ||
? image.rid | ||
: image; | ||
return ret; | ||
@@ -88,0 +84,0 @@ } |
{ | ||
"name": "@tauri-apps/api", | ||
"version": "2.0.0-rc.3", | ||
"version": "2.0.0-rc.4", | ||
"description": "Tauri API definitions", | ||
@@ -49,3 +49,2 @@ "funding": { | ||
"globals": "^15.4.0", | ||
"prettier": "3.3.3", | ||
"rollup": "4.21.0", | ||
@@ -52,0 +51,0 @@ "tslib": "^2.6.3", |
@@ -304,3 +304,3 @@ /** | ||
* ```typescript | ||
* import { getCurrent } from "@tauri-apps/api/webview"; | ||
* import { getCurrentWebview } from "@tauri-apps/api/webview"; | ||
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => { | ||
@@ -307,0 +307,0 @@ * if (event.payload.type === 'hover') { |
@@ -438,3 +438,3 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js'; | ||
* ```typescript | ||
* import { getCurrent } from "@tauri-apps/api/webview"; | ||
* import { getCurrentWebview } from "@tauri-apps/api/webview"; | ||
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => { | ||
@@ -441,0 +441,0 @@ * if (event.payload.type === 'hover') { |
Sorry, the diff of this file is too big to display
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
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
572436
14
14010