json-joy
Version:
Collection of libraries for building collaborative editing apps.
22 lines (21 loc) • 771 B
TypeScript
import { Encoder } from './Encoder';
import { Decoder } from './Decoder';
import type { Patch } from '../../Patch';
/** A shared instance of the {@link Encoder} class. */
export declare const encoder: Encoder;
/**
* Encodes a JSON CRDT Patch into a binary {@link Uint8Array} blob.
*
* @param patch A {@link Patch} to encode.
* @returns A Uint8Array containing the encoded patch.
*/
export declare const encode: (patch: Patch) => Uint8Array;
/** A shared instance of the {@link Decoder} class. */
export declare const decoder: Decoder;
/**
* Decodes a binary {@link Uint8Array} blob into a JSON CRDT Patch.
*
* @param buf Binary blob to decode.
* @returns A {@link Patch} decoded from the binary blob.
*/
export declare const decode: (buf: Uint8Array) => Patch;