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/positioner/src/api-iife.js

2 lines
2.4 KiB

if("__TAURI__"in window){var __TAURI_POSITIONER__=function(e){"use strict";var t=Object.defineProperty,n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},r=(e,t,r)=>(n(e,t,"read from private field"),r?r.call(e):t.get(e)),o=(e,t,r,o)=>(n(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);function i(e,t=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${n}`;return Object.defineProperty(window,r,{value:n=>(t&&Reflect.deleteProperty(window,r),e?.(n)),writable:!1,configurable:!0}),n}((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Channel:()=>s,PluginListener:()=>c,addPluginListener:()=>h,convertFileSrc:()=>d,invoke:()=>_,transformCallback:()=>i});var a,s=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((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)})(this,a,(()=>{})),this.id=i((e=>{r(this,a).call(this,e)}))}set onmessage(e){o(this,a,e)}get onmessage(){return r(this,a)}toJSON(){return`__CHANNEL__:${this.id}`}};a=new WeakMap;var l,c=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return _(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function h(e,t,n){let r=new s;return r.onmessage=n,_(`plugin:${e}|register_listener`,{event:t,handler:r}).then((()=>new c(e,t,r.id)))}async function _(e,t={}){return new Promise(((n,r)=>{let o=i((e=>{n(e),Reflect.deleteProperty(window,`_${a}`)}),!0),a=i((e=>{r(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...t})}))}function d(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}return e.Position=void 0,(l=e.Position||(e.Position={}))[l.TopLeft=0]="TopLeft",l[l.TopRight=1]="TopRight",l[l.BottomLeft=2]="BottomLeft",l[l.BottomRight=3]="BottomRight",l[l.TopCenter=4]="TopCenter",l[l.BottomCenter=5]="BottomCenter",l[l.LeftCenter=6]="LeftCenter",l[l.RightCenter=7]="RightCenter",l[l.Center=8]="Center",l[l.TrayLeft=9]="TrayLeft",l[l.TrayBottomLeft=10]="TrayBottomLeft",l[l.TrayRight=11]="TrayRight",l[l.TrayBottomRight=12]="TrayBottomRight",l[l.TrayCenter=13]="TrayCenter",l[l.TrayBottomCenter=14]="TrayBottomCenter",e.moveWindow=async function(e){await _("plugin:positioner|move_window",{position:e})},e}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_POSITIONER__})}