json-joy
Version:
Collection of libraries for building collaborative editing apps.
58 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConNode = void 0;
const print_1 = require("../../../util/print");
const clock_1 = require("../../../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
*/
class ConNode {
/**
* @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;
/**
* @ignore
*/
this.api = undefined;
}
// ----------------------------------------------------------------- JsonNode
/**
* @ignore
*/
children() { }
/**
* @ignore
*/
child() {
return undefined;
}
/**
* @ignore
*/
container() {
return undefined;
}
view() {
return this.val;
}
name() {
return 'con';
}
// ---------------------------------------------------------------- Printable
toString(tab) {
return this.name() + ' ' + (0, clock_1.printTs)(this.id) + ' ' + (0, print_1.con)(this.val);
}
}
exports.ConNode = ConNode;
//# sourceMappingURL=ConNode.js.map