Initializes a new instance of the Storage class with a Y.Doc instance, a room identifier, and an initial state.
The Y.Doc instance for state synchronization.
The identifier for the room, used in state syncing.
The identifier for the storage, used in state syncing.
The initial state of the storage.
Private
_statePrivate
docThe Y.Doc instance for state synchronization.
Private
initialThe initial state of the storage.
Private
listenersPrivate
roomThe identifier for the room, used in state syncing.
Private
storageThe identifier for the storage, used in state syncing.
Deletes a given key or state from the synced storage.
By key: // state: { ban: false, id: "shape:xxxx" } // given: "ban" => state: { id: "shape:xxxx" }
By state: // state: { ban: false, id: "shape:xxxx" } // given: { ban: true } => state: { id: "shape:xxxx" }
Private
emitPrivate
handleHandles state changes and emits a stateChanged event.
The YMapEvent object.
Initializes the state with the given initial state.
The initial state to be set.
Sets the state based on the provided new state.
A partial state object representing the new state.
Generated using TypeDoc
The Storage class manages and synchronizes state within a Y.Doc.