From a8667799f54e51af3522e0f57877bfcf01fcf0af Mon Sep 17 00:00:00 2001 From: Chris Gathercole Date: Tue, 10 Jan 2017 17:23:03 +0000 Subject: [PATCH] tidied promise chain for handling local crossword data --- src/js/oCrossword.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/js/oCrossword.js b/src/js/oCrossword.js index 7984a63..ccc346f 100644 --- a/src/js/oCrossword.js +++ b/src/js/oCrossword.js @@ -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();