Files
tauri-plugins-workspace/plugins/updater/api-iife.js
T

2 lines
1.2 KiB
JavaScript

if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(e,n){"use strict";class t extends n.Resource{constructor(e){super(e.rid),this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,t){s(t);const d=new n.Channel;e&&(d.onmessage=e);const o=await n.invoke("plugin:updater|download",{onEvent:d,rid:this.rid,...t});this.downloadedBytes=new n.Resource(o)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await n.invoke("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){s(t);const d=new n.Channel;e&&(d.onmessage=e),await n.invoke("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...t})}async close(){await(this.downloadedBytes?.close()),await super.close()}}function s(e){e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries()))}return e.Update=t,e.check=async function(e){s(e);const d=await n.invoke("plugin:updater|check",{...e});return d?new t(d):null},e}({},window.__TAURI__.core);Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})}