(feat) now use md-on-demand for (hopefully) faster mailbox loading

This commit is contained in:
Ludovic Marcotte
2015-08-25 11:45:17 -04:00
parent eeb6be1f08
commit eab3ee111a
2 changed files with 32 additions and 4 deletions

View File

@@ -167,6 +167,35 @@
}
};
/**
* @function getLength
* @memberof Mailbox.prototype
* @desc Used by md-virtual-repeat / md-on-demand
* @returns the number of items in the mailbox
*/
Mailbox.prototype.getLength = function() {
return this.$messages.length;
};
/**
* @function getItemAtIndex
* @memberof Mailbox.prototype
* @desc Used by md-virtual-repeat / md-on-demand
* @returns the message as the specified index
*/
Mailbox.prototype.getItemAtIndex = function(index) {
var message;
if (index >= 0 && index < this.$messages.length) {
message = this.$messages[index];
if (this.$loadMessage(message.uid))
return message;
}
return null;
};
/**
* @function $id
* @memberof Mailbox.prototype
@@ -588,7 +617,7 @@
if (_this.uids) {
Mailbox.$log.debug('unwrapping ' + data.uids.length + ' messages');
// First entry of 'headers' are keys
headers = _.invoke(_this.headers[0], 'toLowerCase');
_this.headers.splice(0, 1);