Skip to content

Commit

Permalink
Merge pull request #3 from ftlabs/localdata
Browse files Browse the repository at this point in the history
tidied promise chain for handling local crossword data
  • Loading branch information
railsagainstignorance authored Jan 10, 2017
2 parents 367c93a + a866779 commit 9c71851
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 9c71851

Please sign in to comment.