Readonly id
Get the object ID of the underlying instance.
If the underlying instance at runtime is not a LiveObject, returns undefined.
Get an in-memory JavaScript object representation of the object instance. For primitive types, this is an alias for calling value().
When compacting a LiveMap, cyclic references are handled through
memoization, returning shared compacted object references for previously
visited objects. This means the value returned from compact() cannot be
directly JSON-stringified if the object may contain cycles.
If the underlying instance's value is not of the expected type at runtime, returns undefined.
Use compactJson() for a JSON-serializable representation.
Get a JSON-serializable representation of the object instance. Binary values are converted to base64-encoded strings.
When compacting a LiveMap, cyclic references are represented as { objectId: string }
instead of in-memory pointers, making the result safe to pass to JSON.stringify().
If the underlying instance's value is not of the expected type at runtime, returns undefined.
Use compact() for an in-memory representation.
An alias for calling increment(-amount)
Optional amount: number
The amount by which to decrease the counter value. If not provided, defaults to 1.
Returns an iterable of key-value pairs for each entry in the map. Each value is represented as an BatchContext corresponding to its key.
If the underlying instance at runtime is not a map, returns an empty iterator.
Navigate to a child entry within the collection by obtaining the BatchContext at that entry. The entry in a collection is identified with a string key.
Returns undefined if:
The key to retrieve the value for.
A BatchContext representing either a LiveObject or a primitive value (string, number, boolean, JSON-serializable object or array, or binary data), or undefined if the underlying instance at runtime is not a collection object, the key does not exist, the referenced LiveObject has been deleted, or this collection object itself has been deleted.
Adds an operation to the current batch to increment the value of the underlying LiveCounterInstance. All queued operations are sent together in a single message once the batch function completes.
If the underlying instance at runtime is not a counter, this method throws an error.
This does not modify the underlying data of the counter. Instead, the change is applied when the published operation is echoed back to the client and applied to the object. To get notified when object gets updated, use PathObject.subscribe or Instance.subscribe, as appropriate.
Optional amount: number
The amount by which to increase the counter value. If not provided, defaults to 1.
Returns an iterable of keys in the map.
If the underlying instance at runtime is not a map, returns an empty iterator.
Adds an operation to the current batch to remove a key from the underlying LiveMapInstance. All queued operations are sent together in a single message once the batch function completes.
If the underlying instance at runtime is not a map, this method throws an error.
This does not modify the underlying data of the map. Instead, the change is applied when the published operation is echoed back to the client and applied to the object. To get notified when object gets updated, use PathObject.subscribe or Instance.subscribe, as appropriate.
The key to remove.
Adds an operation to the current batch to set a key to a specified value on the underlying LiveMapInstance. All queued operations are sent together in a single message once the batch function completes.
If the underlying instance at runtime is not a map, this method throws an error.
This does not modify the underlying data of the map. Instead, the change is applied when the published operation is echoed back to the client and applied to the object. To get notified when object gets updated, use PathObject.subscribe or Instance.subscribe, as appropriate.
The key to set the value for.
The value to assign to the key.
Get the current value of the underlying counter or primitive.
If the underlying instance at runtime is neither a counter nor a primitive value, returns undefined.
The current value of the underlying primitive or counter, or undefined if the value cannot be retrieved.
Returns an iterable of values in the map. Each value is represented as a BatchContext.
If the underlying instance at runtime is not a map, returns an empty iterator.
Generated using TypeDoc
Represents a BatchContext when its underlying type is not known. Provides a unified interface that includes all possible methods.
Each method supports type parameters to specify the expected underlying type when needed.