WeaveStoreStandalone
API reference for the WeaveStoreStandalone class
Overview
The WeaveStoreStandalone is a client/server-side class in Weave.js Standalone store that provides a way to directly render a Room without any of the overhead of the collaboration, useful for example when server-side rendering a room for exporting it to an image.
Import
import { WeaveStoreStandalone } from "@inditextech/weave-store-standalone/server";
Instantiation
const store = new WeaveStoreStandalone(params: WeaveStoreStandaloneParams);
Parameters
Prop | Type | Default |
---|---|---|
initialState? | initialState | FetchInitialState |
roomData | string | - |
TypeScript types
type FetchInitialState = (doc: Y.Doc) => void;
type WeaveStoreStandaloneParams = {
roomData: string;
initialState?: FetchInitialState;
};
Shared-state initial value
If not defined the defaultInitialState
is used, which is nothing more than:
A Stage node with 5 children Layer nodes, in the specified order (bottom-to-top):
- gridLayer: is the layer used by WeaveStageGridPlugin to render the reference grid elements.
- mainLayer: is the main layer where all the nodes added by the users live.
- selectionLayer: is the layer used by WeaveNodesSelectionPlugin to render the selection overlay elements.
- usersPointersLayer: is the layer used by WeaveUsersPointersPlugin to render the users pointers overlay elements.
- utilityLayer: is a wildcard layer defined that can be used by any plugin.
Check out here the code
hat defines the defaultInitialState
function.