Skip to main content
Version: v1

IFluidSerializer Interface

Signature

export interface IFluidSerializer

Methods

MethodReturn TypeDescription
decode(input)any

Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.

The original input object is not mutated. This method will shallowly clone all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

The decoded handles are implicitly bound to the handle context of this serializer.

encode(value, bind)any

Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form.

The original input object is not mutated. This method will shallowly clones all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

parse(value)anyParses the given JSON input string and returns the JavaScript object defined by it. Any Fluid handles will be realized as part of the parse
stringify(value, bind)stringStringifies a given value. Converts any IFluidHandle to its stringified equivalent.

Method Details

decode

Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.

The original input object is not mutated. This method will shallowly clone all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

The decoded handles are implicitly bound to the handle context of this serializer.

Signature

decode(input: any): any;

Parameters

ParameterTypeDescription
inputany

Returns

Return type: any

encode

Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object where any embedded IFluidHandles have been replaced with a serializable form.

The original input object is not mutated. This method will shallowly clones all objects in the path from the root to any replaced handles. (If no handles are found, returns the original object.)

Signature

encode(value: any, bind: IFluidHandle): any;

Parameters

ParameterTypeDescription
valueany
bindIFluidHandle

Returns

Return type: any

parse

Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid handles will be realized as part of the parse

Signature

parse(value: string): any;

Parameters

ParameterTypeDescription
valuestring

Returns

Return type: any

stringify

Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.

Signature

stringify(value: any, bind: IFluidHandle): string;

Parameters

ParameterTypeDescription
valueany
bindIFluidHandle

Returns

Return type: string