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

2 lines
4.1 KiB

if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(i){"use strict";function t(i,t,e,n){if("a"===e&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?i!==t||!n:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?n:"a"===e?n.call(i):n?n.value:t.get(i)}function e(i,t,e,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(i,e):o?o.value=e:t.set(i,e),e}var n,o,a,r,c,s;"function"==typeof SuppressedError&&SuppressedError;class l{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),o.set(this,0),a.set(this,{}),this.id=function(i,t=!1){return window.__TAURI_INTERNALS__.transformCallback(i,t)}((({message:i,id:r})=>{if(r===t(this,o,"f")){e(this,o,r+1,"f"),t(this,n,"f").call(this,i);const c=Object.keys(t(this,a,"f"));if(c.length>0){let i=r+1;for(const e of c.sort()){if(parseInt(e)!==i)break;{const o=t(this,a,"f")[e];delete t(this,a,"f")[e],t(this,n,"f").call(this,o),i+=1}}}}else t(this,a,"f")[r.toString()]=i}))}set onmessage(i){e(this,n,i,"f")}get onmessage(){return t(this,n,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}n=new WeakMap,o=new WeakMap,a=new WeakMap;class u{constructor(i,t,e){this.plugin=i,this.event=t,this.channelId=e}async unregister(){return w(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function f(i,t,e){const n=new l;return n.onmessage=e,w(`plugin:${i}|register_listener`,{event:t,handler:n}).then((()=>new u(i,t,n.id)))}async function w(i,t={},e){return window.__TAURI_INTERNALS__.invoke(i,t,e)}i.ScheduleEvery=void 0,(r=i.ScheduleEvery||(i.ScheduleEvery={})).Year="year",r.Month="month",r.TwoWeeks="twoWeeks",r.Week="week",r.Day="day",r.Hour="hour",r.Minute="minute",r.Second="second";return i.Importance=void 0,(c=i.Importance||(i.Importance={}))[c.None=0]="None",c[c.Min=1]="Min",c[c.Low=2]="Low",c[c.Default=3]="Default",c[c.High=4]="High",i.Visibility=void 0,(s=i.Visibility||(i.Visibility={}))[s.Secret=-1]="Secret",s[s.Private=0]="Private",s[s.Public=1]="Public",i.Schedule=class{static at(i,t=!1,e=!1){return{at:{date:i,repeating:t,allowWhileIdle:e},interval:void 0,every:void 0}}static interval(i,t=!1){return{at:void 0,interval:{interval:i,allowWhileIdle:t},every:void 0}}static every(i,t,e=!1){return{at:void 0,interval:void 0,every:{interval:i,count:t,allowWhileIdle:e}}}},i.active=async function(){return await w("plugin:notification|get_active")},i.cancel=async function(i){await w("plugin:notification|cancel",{notifications:i})},i.cancelAll=async function(){await w("plugin:notification|cancel")},i.channels=async function(){return await w("plugin:notification|listChannels")},i.createChannel=async function(i){await w("plugin:notification|create_channel",{...i})},i.isPermissionGranted=async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await w("plugin:notification|is_permission_granted")},i.onAction=async function(i){return await f("notification","actionPerformed",i)},i.onNotificationReceived=async function(i){return await f("notification","notification",i)},i.pending=async function(){return await w("plugin:notification|get_pending")},i.registerActionTypes=async function(i){await w("plugin:notification|register_action_types",{types:i})},i.removeActive=async function(i){await w("plugin:notification|remove_active",{notifications:i})},i.removeAllActive=async function(){await w("plugin:notification|remove_active")},i.removeChannel=async function(i){await w("plugin:notification|delete_channel",{id:i})},i.requestPermission=async function(){return await window.Notification.requestPermission()},i.sendNotification=function(i){"string"==typeof i?new window.Notification(i):new window.Notification(i.title,i)},i}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})}