Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/common/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export async function removeFromStorage<K extends keyof StorageKV>(key: K) {
await storage.removeItem(`local:${key}`)
}

export function watchStorage<K extends keyof StorageKV>(
key: K,
callback: (newValue: StorageKV[K] | null, oldValue: StorageKV[K] | null) => void
) {
return storage.watch<StorageKV[K]>(`local:${key}`, callback)
}

export async function setWithExpiry<K extends keyof StorageKV>(
key: K,
value: StorageKV[K],
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/call-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface EventName {
| { instanceId?: string; widgetId?: string }
| null
| undefined
cancelWidgetDrag: null
}

export function callEvent<K extends keyof EventName>(eventName: K, data?: EventName[K]) {
Expand Down
Loading
Loading