diff options
| author | Dax Raad <[email protected]> | 2025-05-23 16:20:21 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 12:40:17 -0400 |
| commit | 5f750b7368226ce455a6848f5f744d43179198e5 (patch) | |
| tree | c7b85ed5f9a71ac957cdef04368be62fe7f04745 /js/src/storage | |
| parent | e2dc5a8faf9d4362a99c5cd74a676e3b5436ceb4 (diff) | |
| download | opencode-5f750b7368226ce455a6848f5f744d43179198e5.tar.gz opencode-5f750b7368226ce455a6848f5f744d43179198e5.zip | |
share
Diffstat (limited to 'js/src/storage')
| -rw-r--r-- | js/src/storage/storage.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/js/src/storage/storage.ts b/js/src/storage/storage.ts index 50364beeb..5572c3017 100644 --- a/js/src/storage/storage.ts +++ b/js/src/storage/storage.ts @@ -13,7 +13,7 @@ export namespace Storage { export const Event = { Write: Bus.event( "storage.write", - z.object({ key: z.string(), body: z.any() }), + z.object({ key: z.string(), content: z.any() }), ), }; @@ -50,9 +50,9 @@ export namespace Storage { return JSON.parse(data) as T; } - export async function writeJSON<T>(key: string, data: T) { - Bus.publish(Event.Write, { key, body: data }); - const json = JSON.stringify(data); + export async function writeJSON<T>(key: string, content: T) { + const json = JSON.stringify(content); await write(key + ".json", json); + Bus.publish(Event.Write, { key, content }); } } |
