Skip to main content

ISerializableValue Interface

The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use type to understand whether they're storing a Plain JavaScript object, a SharedObject, or a value type.

This API is deprecated and will be removed in a future release.

This type is legacy and deprecated(AB#8004).

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/map/legacy.

For more information about our API support guarantees, see here.

Signature

export interface ISerializableValue

Remarks

Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate) and ops (set).

If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members that are ISerializedHandle (the serialized form of a handle).

If type is a value type then it must be amongst the types registered via registerValueType or we won't know how to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent. If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a channel ID.

Properties

Property Alerts Type Description
type Alpha string A type annotation to help indicate how the value serializes.
value Alpha any The JSONable representation of the value.

Property Details

type

A type annotation to help indicate how the value serializes.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/map/alpha.

For more information about our API support guarantees, see here.

Signature

type: string;

Type: string

value

The JSONable representation of the value.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/map/alpha.

For more information about our API support guarantees, see here.

Signature

value: any;

Type: any