Cable-Desktop/js/views/message_list_view.js
lilia 470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
2014-11-24 19:25:03 -08:00

24 lines
568 B
JavaScript

var Whisper = Whisper || {};
(function () {
'use strict';
Whisper.MessageListView = Whisper.ListView.extend({
tagName: 'ul',
className: 'discussion',
itemView: Whisper.MessageView,
events: {
'add': 'scrollToBottom'
},
scrollToBottom: function() {
this.$el.scrollTop(this.el.scrollHeight);
},
addAll: function() {
this.$el.html('');
this.collection.each(function(model) {
var view = new this.itemView({model: model});
this.$el.prepend(view.render().el);
}, this);
},
});
})();