* Mail: avoid to send so many requests when user tries to scroll on mail list via key up/down

This commit is contained in:
Hadi Nategh 2018-09-06 16:03:48 +02:00
parent 534dd562f6
commit 24b1dc745a

View File

@ -70,6 +70,12 @@ app.classes.mail = AppJS.extend(
*/
W_INTERVALS:[],
/**
*
* @array of setted timeouts
*/
W_TIMEOUTS: [],
/**
* Initialize javascript for this application
*
@ -1082,12 +1088,19 @@ app.classes.mail = AppJS.extend(
this.mail_selectedMails.push(_id);
}
var self = this;
// Request email body from server
IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:_id}));
jQuery(IframeHandle.getDOMNode()).on('load', function(e){
self.resolveExternalImages (this.contentWindow.document);
});
// Try to avoid sending so many request when user tries to scroll on list
// via key up/down quite fast.
for (var t in this.W_TIMEOUTS) {window.clearTimeout(this.W_TIMEOUTS[t]);}
this.W_TIMEOUTS.push(window.setTimeout(function(){
console.log(_id);
// Request email body from server
IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:_id}));
jQuery(IframeHandle.getDOMNode()).on('load', function(e){
self.resolveExternalImages (this.contentWindow.document);
});
}, 300));
}
if (dataElem.data['smime']) this.smimeAttachmentsCheckerInterval();
var messages = {};