Fix a couple bind()) issues when getting verified state

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-06-16 14:27:43 -07:00
parent b0dbecb4e2
commit 1d7cbc14fd

View file

@ -106,7 +106,10 @@
this.listenTo(this.model, 'expired', this.onExpired); this.listenTo(this.model, 'expired', this.onExpired);
this.listenTo(this.model.messageCollection, 'expired', this.onExpiredCollection); this.listenTo(this.model.messageCollection, 'expired', this.onExpiredCollection);
this.lazyUpdateVerified = _.debounce(this.model.updateVerified, 1000); this.lazyUpdateVerified = _.debounce(
this.model.updateVerified.bind(this.model),
1000
);
this.render(); this.render();
new TimerMenuView({ el: this.$('.timer-menu'), model: this.model }); new TimerMenuView({ el: this.$('.timer-menu'), model: this.model });
@ -309,12 +312,10 @@
onOpened: function() { onOpened: function() {
// TODO: we may want to show a loading dialog until this status fetch // TODO: we may want to show a loading dialog until this status fetch
// and potentially the below message fetch are complete. In the near // and potentially the below message fetch are complete.
// term, just a send block if this statusFetch is incomplete might be
// a good idea.
this.statusFetch = this.model.getProfiles().then(function() { this.statusFetch = this.model.getProfiles().then(function() {
this.model.updateVerified().then(function() { this.model.updateVerified().then(function() {
this.onVerifiedChange.bind(this); this.onVerifiedChange();
this.statusFetch = null; this.statusFetch = null;
console.log('done with status fetch'); console.log('done with status fetch');
}.bind(this)); }.bind(this));