Spaces:
Runtime error
Runtime error
File size: 582 Bytes
6a839c1 423b87b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// @ts-nocheck
import type { LiveObject } from "@liveblocks/client";
import type { Writable } from "svelte/store";
import { writable } from "svelte/store";
import { useRoom } from "./useRoom";
/**
* No `liveblocks-react` public API equivalent, but useStorage is used internally
*/
export function useStorage(): Writable<LiveObject> {
const room = useRoom();
const rootStore = writable<LiveObject>();
async function fetchStorage() {
const { root }: { root: LiveObject } = await room!.getStorage();
rootStore.set(root);
}
fetchStorage();
return rootStore;
}
|