about summary refs log tree commit diff
path: root/src/state/persisted/types.ts
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-08-06 00:30:58 +0100
committerGitHub <noreply@github.com>2024-08-06 00:30:58 +0100
commit5bf7f3769d005e7e606e4b10327eb7467f59f0aa (patch)
tree1e1e2d1bb011b25a9153f39d8ba5f2281b0e1105 /src/state/persisted/types.ts
parent74b0318d89b5ec4746cd4861f8573ea24c6ccea1 (diff)
downloadvoidsky-5bf7f3769d005e7e606e4b10327eb7467f59f0aa.tar.zst
[Persisted] Fork web and native, make it synchronous on the web (#4872)
* Delete logic for legacy storage

* Delete superfluous tests

At this point these tests aren't testing anything useful, let's just get rid of them.

* Inline store.ts methods into persisted/index.ts

* Fork persisted/index.ts into index.web.ts

* Remove non-essential code and comments from both forks

* Remove async/await from web fork of persisted/index.ts

* Remove unused return

* Enforce that forked types match
Diffstat (limited to 'src/state/persisted/types.ts')
-rw-r--r--src/state/persisted/types.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state/persisted/types.ts b/src/state/persisted/types.ts
new file mode 100644
index 000000000..95852f796
--- /dev/null
+++ b/src/state/persisted/types.ts
@@ -0,0 +1,9 @@
+import type {Schema} from './schema'
+
+export type PersistedApi = {
+  init(): Promise<void>
+  get<K extends keyof Schema>(key: K): Schema[K]
+  write<K extends keyof Schema>(key: K, value: Schema[K]): Promise<void>
+  onUpdate(_cb: () => void): () => void
+  clearStorage: () => Promise<void>
+}