diff options
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 }); } } |
