You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tauri-plugins-workspace/plugins/clipboard-manager/api-iife.js

2 lines
2.0 KiB

if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARDMANAGER__=function(e){"use strict";var t;async function n(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}"function"==typeof SuppressedError&&SuppressedError;class r{get rid(){return function(e,t,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}(this,t)}constructor(e){t.set(this,void 0),function(e,t,n,r,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,n)}(this,t,e)}async close(){return n("plugin:resources|close",{rid:this.rid})}}t=new WeakMap;class a extends r{constructor(e){super(e)}static async new(e,t,r){return n("plugin:image|new",{rgba:i(e),width:t,height:r}).then((e=>new a(e)))}static async fromBytes(e){return n("plugin:image|from_bytes",{bytes:i(e)}).then((e=>new a(e)))}static async fromPath(e){return n("plugin:image|from_path",{path:e}).then((e=>new a(e)))}async rgba(){return n("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return n("plugin:image|size",{rid:this.rid})}}function i(e){return null==e?null:"string"==typeof e?e:e instanceof Uint8Array?Array.from(e):e instanceof ArrayBuffer?Array.from(new Uint8Array(e)):e instanceof a?e.rid:e}return e.clear=async function(){await n("plugin:clipboard-manager|clear")},e.readImage=async function(){return await n("plugin:clipboard-manager|read_image").then((e=>new a(e)))},e.readText=async function(){return(await n("plugin:clipboard-manager|read_text")).plainText.text},e.writeHtml=async function(e,t){await n("plugin:clipboard-manager|write_html",{data:{html:{html:e,altHtml:t}}})},e.writeImage=async function(e){await n("plugin:clipboard-manager|write_image",{data:{image:{image:i(e)}}})},e.writeText=async function(e,t){await n("plugin:clipboard-manager|write_text",{data:{plainText:{label:t?.label,text:e}}})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARDMANAGER__})}