UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

64 lines (63 loc) 1.63 kB
import { type ITimestampStruct } from '../../../json-crdt-patch/clock'; import type { JsonNode, JsonNodeView } from '..'; import type { Model } from '../../model'; import type { Printable } from 'tree-dump/lib/types'; /** * Represents a `val` JSON CRDT node, which is a Last-write-wins (LWW) register. * The `val` node holds a single value, which is a reference to another JSON * CRDT node. * * @category CRDT Node */ export declare class ValNode<Value extends JsonNode = JsonNode> implements JsonNode<JsonNodeView<Value>>, Printable { /** * @ignore */ readonly doc: Model<any>; readonly id: ITimestampStruct; /** * The current value of the node, which is a reference to another JSON CRDT * node. */ val: ITimestampStruct; constructor( /** * @ignore */ doc: Model<any>, id: ITimestampStruct, /** * The current value of the node, which is a reference to another JSON CRDT * node. */ val: ITimestampStruct); /** * @ignore */ set(val: ITimestampStruct): ITimestampStruct | undefined; /** * Returns the latest value of the node, the JSON CRDT node that `val` points * to. * * @returns The latest value of the node. */ node(): Value; view(): JsonNodeView<Value>; /** * @ignore */ children(callback: (node: Value) => void): void; /** * @ignore */ child(): Value; /** * @ignore */ container(): JsonNode | undefined; /** * @ignore */ api: undefined | unknown; name(): string; toString(tab?: string): string; }