Move inbox collection to the background page

No more waiting, no more messy fetch logic. Background page
bootstraps the inbox and keeps it up to date.
This commit is contained in:
lilia 2015-02-10 15:27:26 -08:00
parent a5bc261365
commit 44b1e5c88e
5 changed files with 55 additions and 24 deletions

View file

@ -29,22 +29,11 @@
this.newConversationView = new Whisper.NewConversationView();
this.newConversationView.$el.hide().appendTo(this.$gutter);
this.conversations = new Whisper.ConversationCollection();
this.inbox = new Whisper.ConversationListView({
el : this.$contacts,
collection : this.conversations
});
collection : bg.inbox
}).render();
this.$el.addClass('loading');
this.conversations.fetchActive({reset: true}).then(function() {
this.inbox.resize();
this.$el.removeClass('loading');
window.conversations = this.conversations; // debug
}.bind(this));
extension.on('message', function() {
this.conversations.fetchActive({reset: true});
}.bind(this));
window.addEventListener('resize', this.inbox.resize.bind(this.inbox));
},
events: {