mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
tidy up serve tool, adds 'gulp serve' task
This commit is contained in:
parent
338bc64884
commit
c965cb5408
8 changed files with 2148 additions and 1521 deletions
|
@ -144,10 +144,42 @@ EPUBJS.Rendition.prototype.bounds = function() {
|
|||
|
||||
EPUBJS.Rendition.prototype.display = function(what){
|
||||
|
||||
return this.q.enqueue(this.load, what);
|
||||
return this.q.enqueue(function(what){
|
||||
|
||||
var displaying = new RSVP.defer();
|
||||
var displayed = displaying.promise;
|
||||
|
||||
var section = this.book.spine.get(what);
|
||||
var view;
|
||||
|
||||
this.displaying = true;
|
||||
|
||||
if(section){
|
||||
view = new EPUBJS.View(section);
|
||||
|
||||
// This will clear all previous views
|
||||
this.fill(view);
|
||||
|
||||
// Move to correct place within the section, if needed
|
||||
// this.moveTo(what)
|
||||
|
||||
this.check();
|
||||
|
||||
view.displayed.then(function(){
|
||||
this.trigger("displayed", section);
|
||||
this.displaying = false;
|
||||
displaying.resolve(this);
|
||||
}.bind(this));
|
||||
|
||||
} else {
|
||||
displaying.reject(new Error("No Section Found"));
|
||||
}
|
||||
|
||||
return displayed;
|
||||
}, what);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
EPUBJS.Rendition.prototype.load = function(what){
|
||||
var displaying = new RSVP.defer();
|
||||
var displayed = displaying.promise;
|
||||
|
@ -180,7 +212,7 @@ EPUBJS.Rendition.prototype.load = function(what){
|
|||
|
||||
return displayed;
|
||||
};
|
||||
|
||||
*/
|
||||
// Takes a cfi, fragment or page?
|
||||
EPUBJS.Rendition.prototype.moveTo = function(what){
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue