import type { Update } from '@tauri-apps/plugin-updater' import { check } from '@tauri-apps/plugin-updater' import { createGlobalState } from '@vueuse/core' export const useUpdater = createGlobalState(() => { const lastUpdate = shallowRef() const checking = ref(false) async function checkForUpdates() { try { checking.value = true lastUpdate.value = (await check()) ?? undefined } finally { checking.value = false } return lastUpdate.value } return { lastUpdate, checkForUpdates, } })