json-joy
Version:
Collection of libraries for building collaborative editing apps.
24 lines (23 loc) • 485 B
JavaScript
export class Draft {
base;
head;
tip;
constructor(opts) {
const base = (this.base = opts.base);
const head = (this.head = base.clone());
this.tip = opts.tip;
for (const patch of opts.head)
head.applyPatch(patch);
}
/**
*
* @param patches
*/
rebase(patches) {
this.base.applyBatch(patches);
this.head.applyBatch(patches);
}
advance(index) { }
undo() { }
redo() { }
}