FluidSerializer Class
Data Store serializer implementation
Signature
export declare class FluidSerializer implements IFluidSerializer
Implements: IFluidSerializer
Constructors
| Constructor | Description |
|---|---|
| (constructor)(context, handleParsedCb) | Constructs a new instance of the FluidSerializer class |
Properties
| Property | Type | Description |
|---|---|---|
| IFluidSerializer | this |
Methods
| Method | Return Type | Description |
|---|---|---|
| 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 The decoded handles are implicitly bound to the handle context of this serializer. |
| encode(input, bind) | any |
Given a mostly-jsonable object tree that may have handle objects embedded within, will return a fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form. The original Any unbound handles encountered are bound to the provided IFluidHandle. |
| parse(input) | any | |
| serializeHandle(handle, bind) | { type: string; url: string; } | |
| stringify(input, bind) | string |
Constructor Details
(constructor)
Constructs a new instance of the FluidSerializer class
Signature
constructor(context: IFluidHandleContext, handleParsedCb: (handle: IFluidHandle) => void);
Parameters
| Parameter | Type | Description |
|---|---|---|
| context | IFluidHandleContext | |
| handleParsedCb | (handle: IFluidHandle) => void |
Property Details
IFluidSerializer
Signature
get IFluidSerializer(): this;
Type: this
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
| Parameter | Type | Description |
|---|---|---|
| input | any |
Returns
Return type: any
encode
Given a mostly-jsonable object tree that may have handle objects embedded within, will return a fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable 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.)
Any unbound handles encountered are bound to the provided IFluidHandle.
Signature
encode(input: any, bind: IFluidHandle): any;
Parameters
| Parameter | Type | Description |
|---|---|---|
| input | any | |
| bind | IFluidHandle |
Returns
Return type: any
parse
Signature
parse(input: string): any;
Parameters
| Parameter | Type | Description |
|---|---|---|
| input | string |
Returns
Return type: any
serializeHandle
Signature
protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
type: string;
url: string;
};
Parameters
| Parameter | Type | Description |
|---|---|---|
| handle | IFluidHandle | |
| bind | IFluidHandle |
Returns
Return type: { type: string; url: string; }
stringify
Signature
stringify(input: any, bind: IFluidHandle): string;
Parameters
| Parameter | Type | Description |
|---|---|---|
| input | any | |
| bind | IFluidHandle |
Returns
Return type: string