1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Only trim after destroy, no trim timeout

This commit is contained in:
Fred Chasen 2015-05-29 17:04:55 -04:00
parent 812be32e71
commit 42efc34517
4 changed files with 24 additions and 22 deletions

View file

@ -126,7 +126,6 @@ EPUBJS.Continuous.prototype.append = function(view){
this.views.push(view);
this.container.appendChild(view.element);
// view.on("shown", this.afterDisplayed.bind(this));
view.onShown = this.afterDisplayed.bind(this);
@ -241,31 +240,33 @@ EPUBJS.Continuous.prototype.check = function(){
var visible = this.isVisible(view, this.settings.offset, container);
if(visible) {
if(!view.shown && !view.rendering) {
// console.log("render",view.section.index)
promises.push(this.render(view));
}
} else {
if(view.shown) {
// console.log("destroy", view.section.index)
view.destroy();
this.q.enqueue(this.trim);
}
}
}.bind(this));
clearTimeout(this.trimTimeout);
this.trimTimeout = setTimeout(function(){
this.q.enqueue(this.trim);
}.bind(this), 250);
// clearTimeout(this.trimTimeout);
// this.trimTimeout = setTimeout(function(){
// this.q.enqueue(this.trim);
// }.bind(this), 250);
if(promises.length){
return RSVP.all(promises)
.then(function(posts) {
// Check to see if anything new is on screen after rendering
this.q.enqueue(this.check);