UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

56 lines 1.4 kB
import { con as printCon } from '../../../util/print'; import { printTs } from '../../../json-crdt-patch/clock'; /** * Represents the `con` type of the JSON CRDT specification. * * Constant type represents an immutable JSON value. It can be any JSON/CBOR * value including deeply nested objects and arrays, Uint8Array binary data, or * it can store a logical timestamp. The constant value cannot be edited. * * @category CRDT Node */ export class ConNode { id; val; /** * @param id ID of the CRDT node. * @param val Raw value of the constant. It can be any JSON/CBOR value, or * a logical timestamp {@link Timestamp}. */ constructor(id, val) { this.id = id; this.val = val; } // ----------------------------------------------------------------- JsonNode /** * @ignore */ children() { } /** * @ignore */ child() { return undefined; } /** * @ignore */ container() { return undefined; } view() { return this.val; } /** * @ignore */ api = undefined; name() { return 'con'; } // ---------------------------------------------------------------- Printable toString(tab) { return this.name() + ' ' + printTs(this.id) + ' ' + printCon(this.val); } } //# sourceMappingURL=ConNode.js.map