summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/utility')
-rw-r--r--packages/frontend/src/utility/storage.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/frontend/src/utility/storage.ts b/packages/frontend/src/utility/storage.ts
index 86f4b8b3c3..42743f78ea 100644
--- a/packages/frontend/src/utility/storage.ts
+++ b/packages/frontend/src/utility/storage.ts
@@ -3,13 +3,21 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { ref } from 'vue';
+import { readonly, ref } from 'vue';
import * as os from '@/os.js';
import { store } from '@/store.js';
import { i18n } from '@/i18n.js';
export const storagePersistenceSupported = window.isSecureContext && 'storage' in navigator;
-export const storagePersisted = ref(storagePersistenceSupported ? await navigator.storage.persisted() : false);
+const storagePersisted = ref(false);
+
+export async function getStoragePersistenceStatusRef() {
+ if (storagePersistenceSupported) {
+ storagePersisted.value = await navigator.storage.persisted().catch(() => false);
+ }
+
+ return readonly(storagePersisted);
+}
export async function enableStoragePersistence() {
if (!storagePersistenceSupported) return;