ced295a630
Getting up and running with IndexedDB was pretty easy, thanks to backbone. The tricky part was making reads and writes asynchronous. In that process I did some refactoring on Whisper.Threads, which has been renamed Conversations for consistency with the view names. This change also adds the unlimitedStorage permission.
24 lines
562 B
JavaScript
24 lines
562 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);
|
|
});
|
|
},
|
|
});
|
|
})();
|