Don't make a new collection on every call to thread.messages()
This commit is contained in:
parent
7e20838128
commit
6d5e32bca8
1 changed files with 5 additions and 3 deletions
|
@ -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…
Reference in a new issue