aboutsummaryrefslogtreecommitdiff
path: root/extension/src/features/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/features/util.ts')
-rw-r--r--extension/src/features/util.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/extension/src/features/util.ts b/extension/src/features/util.ts
index e9147bc..6ec8f15 100644
--- a/extension/src/features/util.ts
+++ b/extension/src/features/util.ts
@@ -1,4 +1,4 @@
-// Copyright (C) 2023 Vaughn Nugent
+// Copyright (C) 2024 Vaughn Nugent
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
@@ -20,15 +20,19 @@ import { type MaybeRefOrGetter, type WatchSource, isProxy, toRaw } from "vue";
import type { Watchable } from "./types";
export const waitForChange = <T extends Readonly<WatchSource<unknown>[]>>(source: [...T]):Promise<void> => {
- return new Promise((resolve) => watchOnce(source, () => resolve()))
+ return new Promise((resolve) => watchOnce<any>(source, () => resolve(), { deep: true }))
}
export const waitForChangeFn = <T extends Readonly<WatchSource<unknown>[]>>(source: [...T]) => {
return (): Promise<void> => {
- return new Promise((resolve) => watchOnce(source, () => resolve()))
+ return new Promise((resolve) => watchOnce<any>(source, () => resolve(), {deep: true}))
}
}
+export const waitOne = <T extends Readonly<WatchSource<unknown>[]>>(source: [...T]): Promise<void> => {
+ return new Promise((resolve) => watchOnce<any>(source, () => resolve(), { deep: true }))
+}
+
export const useStorage = <T>(storage: any & chrome.storage.StorageArea, key: string, initialValue: MaybeRefOrGetter<T>): RemovableRef<T> => {
const wrapper: StorageLikeAsync = {