Cable-Desktop/js/views/message_list_view.js
lilia 99a2685f93 Store attachments as binary blobs
Move base64 encoding of attachments to an AttachmentView. This makes
image rendering an asynchronous task so we fire an update event to
indicate to the parent MessageListView that its content has changed
height and it is time to scroll down.
2014-11-25 12:42:44 -08:00

23 lines
591 B
JavaScript

var Whisper = Whisper || {};
(function () {
'use strict';
Whisper.MessageListView = Whisper.ListView.extend({
tagName: 'ul',
className: 'discussion',
itemView: Whisper.MessageView,
events: {
'add': 'scrollToBottom',
'update *': 'scrollToBottom'
},
scrollToBottom: function() {
// TODO: Avoid scrolling if user has manually scrolled up?
this.$el.scrollTop(this.el.scrollHeight);
},
addAll: function() {
Whisper.ListView.prototype.addAll.apply(this, arguments); // super()
this.scrollToBottom();
},
});
})();