Cable-Desktop/js/views/message_list_view.js

24 lines
591 B
JavaScript
Raw Normal View History

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() {
2014-11-21 01:30:52 +01:00
Whisper.ListView.prototype.addAll.apply(this, arguments); // super()
this.scrollToBottom();
},
});
})();