collaborative-editor
Version:
JSON CRDT str node bindings to any generic plain text editor.
21 lines • 617 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.invokeFirstOnly = exports.applyChange = void 0;
const applyChange = (view, position, remove, insert) => view.slice(0, position) + insert + view.slice(position + remove);
exports.applyChange = applyChange;
const invokeFirstOnly = () => {
let invoked = false;
return (fn) => {
if (invoked)
return;
invoked = true;
try {
fn();
}
finally {
invoked = false;
}
};
};
exports.invokeFirstOnly = invokeFirstOnly;
//# sourceMappingURL=util.js.map
;