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:
parent
812be32e71
commit
42efc34517
4 changed files with 24 additions and 22 deletions
21
dist/epub.js
vendored
21
dist/epub.js
vendored
|
@ -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);
|
||||||
|
|
||||||
|
@ -5712,31 +5711,33 @@ EPUBJS.Continuous.prototype.check = function(){
|
||||||
var visible = this.isVisible(view, this.settings.offset, container);
|
var visible = this.isVisible(view, this.settings.offset, container);
|
||||||
|
|
||||||
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
4
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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);
|
||||||
|
|
||||||
|
@ -241,31 +240,33 @@ EPUBJS.Continuous.prototype.check = function(){
|
||||||
var visible = this.isVisible(view, this.settings.offset, container);
|
var visible = this.isVisible(view, this.settings.offset, container);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue