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

21
dist/epub.js vendored
View file

@ -4577,9 +4577,9 @@ EPUBJS.View.prototype.resized = function(e) {
EPUBJS.View.prototype.display = function(_request) {
if(this.rendering){
return this.displayed;
}
// if(this.rendering){
// return this.displayed;
// }
this.rendering = true;
this.displaying = new RSVP.defer();
@ -5597,7 +5597,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);
@ -5712,31 +5711,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);

4
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

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);

View file

@ -176,9 +176,9 @@ EPUBJS.View.prototype.resized = function(e) {
EPUBJS.View.prototype.display = function(_request) {
if(this.rendering){
return this.displayed;
}
// if(this.rendering){
// return this.displayed;
// }
this.rendering = true;
this.displaying = new RSVP.defer();