Don't make a new collection on every call to thread.messages()

pull/749/head
lilia 12 years ago
parent 7e20838128
commit 6d5e32bca8

@ -40,9 +40,11 @@ var Whisper = Whisper || {};
},
messages: function() {
var messages = new Whisper.MessageCollection([], {threadId: this.id});
messages.fetch();
return messages;
if (!this.messageCollection) {
this.messageCollection = new Whisper.MessageCollection([], {threadId: this.id});
}
this.messageCollection.fetch();
return this.messageCollection;
},
});

Loading…
Cancel
Save