Skip to content

Commit

Permalink
docs(json-crdt-extensions): ✏️ update MV-Register demo to use deeper …
Browse files Browse the repository at this point in the history
…object
  • Loading branch information
streamich committed Mar 4, 2024
1 parent 0c600f9 commit 0a01ade
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/json-crdt-extensions/mval/__demos__/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ const model = Model.withLogicalClock(1234);
model.ext.register(ValueMvExt)

model.api.root({
mv: ValueMvExt.new(1),
obj: {
mv: ValueMvExt.new(1),
},
});

console.log('');
console.log('Initial value:');
console.log(model + '');

const api = model.api.in('mv').asExt(ValueMvExt);
const api = model.api.in(['obj', 'mv']).asExt(ValueMvExt);

api.set(5);

Expand All @@ -33,7 +35,7 @@ console.log(model + '');

const model2 = model.fork();

const api2 = model2.api.in('mv').asExt(ValueMvExt);
const api2 = model2.api.in(['obj', 'mv']).asExt(ValueMvExt);

api.set(10);
api2.set(20);
Expand Down

0 comments on commit 0a01ade

Please sign in to comment.