Skip to content

Commit

Permalink
fix: more readable asynchronous code
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfaller committed Feb 1, 2024
1 parent 3fcc8b9 commit dd8cd10
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client.diff/src/main/resources/web/dist/launch-mergely.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const doc = new Mergely('#compare', { cmsettings : { readOnly: true, lineNumbers: true, lineWrapping: true }});
doc.once('updated', () => {
Promise.all([fetch(lhs_url), fetch(rhs_url)]).then((values) => {
Promise.all([values[0].text(), values[1].text()]).then((values) => {
doc.lhs(values[0]);
doc.rhs(values[1]);

doc.once('updated', () => {
doc.scrollToDiff('next');
});
Promise.all([
fetch(lhs_url).then(result => result.text()),
fetch(rhs_url).then(result => result.text())
]).then(([lhs, rhs]) => {
doc.lhs(lhs);
doc.rhs(rhs);
doc.once('updated', () => {
doc.scrollToDiff('next');
});
});
});

0 comments on commit dd8cd10

Please sign in to comment.