1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +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

19
dist/epub.js vendored
View file

@ -4577,9 +4577,9 @@ EPUBJS.View.prototype.resized = function(e) {
EPUBJS.View.prototype.display = function(_request) { EPUBJS.View.prototype.display = function(_request) {
if(this.rendering){ // if(this.rendering){
return this.displayed; // return this.displayed;
} // }
this.rendering = true; this.rendering = true;
this.displaying = new RSVP.defer(); this.displaying = new RSVP.defer();
@ -5597,7 +5597,6 @@ EPUBJS.Continuous.prototype.append = function(view){
this.views.push(view); this.views.push(view);
this.container.appendChild(view.element); this.container.appendChild(view.element);
// view.on("shown", this.afterDisplayed.bind(this)); // view.on("shown", this.afterDisplayed.bind(this));
view.onShown = this.afterDisplayed.bind(this); view.onShown = this.afterDisplayed.bind(this);
@ -5714,29 +5713,31 @@ EPUBJS.Continuous.prototype.check = function(){
if(visible) { if(visible) {
if(!view.shown && !view.rendering) { if(!view.shown && !view.rendering) {
// console.log("render",view.section.index)
promises.push(this.render(view)); promises.push(this.render(view));
} }
} else { } else {
if(view.shown) { if(view.shown) {
// console.log("destroy", view.section.index)
view.destroy(); view.destroy();
this.q.enqueue(this.trim);
} }
} }
}.bind(this)); }.bind(this));
clearTimeout(this.trimTimeout); // clearTimeout(this.trimTimeout);
this.trimTimeout = setTimeout(function(){ // this.trimTimeout = setTimeout(function(){
this.q.enqueue(this.trim); // this.q.enqueue(this.trim);
}.bind(this), 250); // }.bind(this), 250);
if(promises.length){ if(promises.length){
return RSVP.all(promises) return RSVP.all(promises)
.then(function(posts) { .then(function(posts) {
// Check to see if anything new is on screen after rendering // Check to see if anything new is on screen after rendering
this.q.enqueue(this.check); 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.views.push(view);
this.container.appendChild(view.element); this.container.appendChild(view.element);
// view.on("shown", this.afterDisplayed.bind(this)); // view.on("shown", this.afterDisplayed.bind(this));
view.onShown = this.afterDisplayed.bind(this); view.onShown = this.afterDisplayed.bind(this);
@ -243,29 +242,31 @@ EPUBJS.Continuous.prototype.check = function(){
if(visible) { if(visible) {
if(!view.shown && !view.rendering) { if(!view.shown && !view.rendering) {
// console.log("render",view.section.index)
promises.push(this.render(view)); promises.push(this.render(view));
} }
} else { } else {
if(view.shown) { if(view.shown) {
// console.log("destroy", view.section.index)
view.destroy(); view.destroy();
this.q.enqueue(this.trim);
} }
} }
}.bind(this)); }.bind(this));
clearTimeout(this.trimTimeout); // clearTimeout(this.trimTimeout);
this.trimTimeout = setTimeout(function(){ // this.trimTimeout = setTimeout(function(){
this.q.enqueue(this.trim); // this.q.enqueue(this.trim);
}.bind(this), 250); // }.bind(this), 250);
if(promises.length){ if(promises.length){
return RSVP.all(promises) return RSVP.all(promises)
.then(function(posts) { .then(function(posts) {
// Check to see if anything new is on screen after rendering // Check to see if anything new is on screen after rendering
this.q.enqueue(this.check); this.q.enqueue(this.check);

View file

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