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() {
|
messages: function() {
|
||||||
var messages = new Whisper.MessageCollection([], {threadId: this.id});
|
if (!this.messageCollection) {
|
||||||
messages.fetch();
|
this.messageCollection = new Whisper.MessageCollection([], {threadId: this.id});
|
||||||
return messages;
|
}
|
||||||
|
this.messageCollection.fetch();
|
||||||
|
return this.messageCollection;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue