Skip to content

Commit

Permalink
style(json-crdt): 💄 run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 29, 2024
1 parent ef7ddec commit b7269d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/json-crdt/__demos__/events-level1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const main = async () => {
console.log('Executing: model.applyPatch(patch)');
console.log('');
model.applyPatch(patch);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -106,7 +106,7 @@ const main = async () => {
console.log('Executing: model.reset(model0)');
console.log('');
model.reset(model0);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -117,7 +117,7 @@ const main = async () => {
console.log('Executing: model.api.root(456)');
console.log('');
model.api.root(456);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -133,7 +133,7 @@ const main = async () => {
a: 'b',
});
});
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand Down
17 changes: 9 additions & 8 deletions src/json-crdt/__demos__/events-level2-arr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const main = async () => {
my: {
deep: {
arr: [],
}
}
},
},
});

// Print out the document state.
Expand All @@ -39,7 +39,7 @@ const main = async () => {
console.log('Changes which result in view change:');
console.log('');
model.api.arr(['my', 'deep', 'arr']).ins(0, [1, 2, 3]);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -55,7 +55,7 @@ const main = async () => {
// .del(1, 1)
// .ins(1, [konst(2)]);
// });
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -66,11 +66,12 @@ const main = async () => {
console.log('More changes which result in only model change:');
console.log('');
// model.api.transaction(() => {
model.api.arr(['my', 'deep', 'arr'])
.del(1, 1)
.ins(1, [konst(2)]);
model.api
.arr(['my', 'deep', 'arr'])
.del(1, 1)
.ins(1, [konst(2)]);
// });
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand Down
8 changes: 4 additions & 4 deletions src/json-crdt/__demos__/events-level2-obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const main = async () => {
my: {
deep: {
obj: {},
}
}
},
},
});

// Print out the document state.
Expand All @@ -39,7 +39,7 @@ const main = async () => {
console.log('Changes which result in view change:');
console.log('');
model.api.obj(['my', 'deep', 'obj']).set({foo: 'bar'});
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand All @@ -50,7 +50,7 @@ const main = async () => {
console.log('Changes which result in only model change:');
console.log('');
model.api.obj(['my', 'deep', 'obj']).set({foo: konst('bar')});
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
console.log('');

// Print out the document state.
Expand Down
14 changes: 7 additions & 7 deletions src/json-crdt/model/api/__tests__/ArrayApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ describe('events', () => {
myArr: [1, 2, 3],
});
const events: any[] = [];
doc.api.arr(['myArr']).events.onViewChanges.listen(data => {
doc.api.arr(['myArr']).events.onViewChanges.listen((data) => {
events.push(data);
});
expect(events.length).toBe(0);
doc.api.arr(['myArr']).del(1, 1);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
expect(events.length).toBe(1);
});

Expand All @@ -45,18 +45,18 @@ describe('events', () => {
myArr: [1, 2, 3],
});
const events: any[] = [];
doc.api.arr(['myArr']).events.onViewChanges.listen(data => {
doc.api.arr(['myArr']).events.onViewChanges.listen((data) => {
events.push(data);
});
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
expect(events.length).toBe(0);
doc.api.arr(['myArr']).del(1, 1);
doc.api.arr(['myArr']).ins(1, [konst(2)]);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
expect(events.length).toBe(0);
doc.api.arr(['myArr']).del(1, 1);
doc.api.arr(['myArr']).ins(1, [2]);
await new Promise(r => setTimeout(r, 1));
await new Promise((r) => setTimeout(r, 1));
expect(events.length).toBe(0);
});
});
});

0 comments on commit b7269d8

Please sign in to comment.