@tonk/keepsync
Version:
A reactive sync engine framework for use with Tonk apps
26 lines (25 loc) • 1 kB
TypeScript
/**
* Serializes an object using SuperJSON while filtering out functions
* This preserves Date objects, Maps, Sets, RegExp, BigInt, etc. but removes functions
*
* @param obj The object to serialize
* @returns Serialized object that can be stored in Automerge
*/
export declare function serializeForSync<T>(obj: T): any;
/**
* Deserializes an object that was serialized with serializeForSync
* This restores Date objects, Maps, Sets, RegExp, BigInt, etc.
*
* @param serializedObj The serialized object from Automerge
* @returns Deserialized object with complex types restored
*/
export declare function deserializeFromSync<T>(serializedObj: any): T;
/**
* Checks if two objects are equal after serialization
* This is used to determine if the store needs to be updated
*
* @param obj1 First object to compare
* @param obj2 Second object to compare
* @returns true if the objects are equal after serialization
*/
export declare function areSerializedEqual<T>(obj1: T, obj2: T): boolean;