wearethoughtfox / amnesty-facebook

0 stars 0 forks source link

Async dictionary + loading screen #68

Closed robertocarroll closed 7 years ago

robertocarroll commented 7 years ago
pauldwaite commented 7 years ago

Excellent, yeah that seems to work great. I’ve made a couple of wee tweaks:

  1. I’ve changed the syntax for the templateContext functions from the new ES6 one (templateContext() {}) to the old ES5 one (templateContext: function () {}), partially for consistency with the rest of the code, and partially because build:js seems to barf on the ES6 syntax. (At least it did for me — I may be doing something wrong.)

  2. I’ve re-instated the Promise-based design for dictionary.loadStrings(). With your original change, we were loading the dictionary asynchronously, but we weren’t actually waiting for it to load before starting the app and calling the view functions, so if the dictionary loaded more slowly, I think we would have got an error.

    dictionary.loadStrings() now returns a promise, and we wait for it (and the Facebook API load promise) to resolve before starting the app.