Skip to content

Commit

Permalink
tidied promise chain for handling local crossword data
Browse files Browse the repository at this point in the history
  • Loading branch information
railsagainstignorance committed Jan 10, 2017
1 parent 7aa1c70 commit a866779
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/js/oCrossword.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ function OCrossword(rootEl) {
.then(json => buildGrid(rootEl, json))
.then(() => this.assemble());
} else { // assume this is json text
return new Promise(() => {
let json = JSON.parse(this.rootEl.dataset.oCrosswordData);
buildGrid(rootEl, json);
})
.then(() => this.assemble());
return new Promise((resolve) => resolve( JSON.parse(this.rootEl.dataset.oCrosswordData) ) )
.then(json => buildGrid(rootEl, json))
.then(() => this.assemble() );
}
} else {
this.assemble();
Expand Down

0 comments on commit a866779

Please sign in to comment.