mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Allow checkLocation to return a promise
This commit is contained in:
parent
ff081bc389
commit
4e7276c151
5 changed files with 32 additions and 6 deletions
17
dist/epub.js
vendored
17
dist/epub.js
vendored
|
@ -7394,7 +7394,11 @@ Contents.prototype.fit = function(width, height){
|
|||
this.css("backgroundColor", "transparent");
|
||||
};
|
||||
|
||||
Contents.prototype.mapPage = function(cfiBase, start, end) {
|
||||
var mapping = new Mapping();
|
||||
|
||||
return mapping.page(this, cfiBase, start, end);
|
||||
};
|
||||
|
||||
Contents.prototype.destroy = function() {
|
||||
// Stop observing
|
||||
|
@ -11821,8 +11825,17 @@ Rendition.prototype.spread = function(spread, min){
|
|||
|
||||
Rendition.prototype.reportLocation = function(){
|
||||
return this.q.enqueue(function(){
|
||||
this.location = this.manager.currentLocation();
|
||||
this.trigger("locationChanged", this.location);
|
||||
var location = this.manager.currentLocation();
|
||||
if (location.then && typeof location.then === 'function') {
|
||||
location.then(function(result) {
|
||||
this.location = result;
|
||||
this.trigger("locationChanged", this.location);
|
||||
}.bind(this));
|
||||
} else {
|
||||
this.location = location;
|
||||
this.trigger("locationChanged", this.location);
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
|
2
dist/epub.js.map
vendored
2
dist/epub.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -118,7 +118,7 @@
|
|||
<div id="next" class="arrow">›</div>
|
||||
<script>
|
||||
// Load the opf
|
||||
var book = ePub("https://s3.amazonaws.com/moby-dick/moby-dick.epub");
|
||||
window.book = ePub("https://s3.amazonaws.com/moby-dick/moby-dick.epub");
|
||||
var rendition = book.renderTo("viewer", {
|
||||
manager: "continuous",
|
||||
flow: "paginated",
|
||||
|
|
|
@ -635,7 +635,11 @@ Contents.prototype.fit = function(width, height){
|
|||
this.css("backgroundColor", "transparent");
|
||||
};
|
||||
|
||||
Contents.prototype.mapPage = function(cfiBase, start, end) {
|
||||
var mapping = new Mapping();
|
||||
|
||||
return mapping.page(this, cfiBase, start, end);
|
||||
};
|
||||
|
||||
Contents.prototype.destroy = function() {
|
||||
// Stop observing
|
||||
|
|
|
@ -360,8 +360,17 @@ Rendition.prototype.spread = function(spread, min){
|
|||
|
||||
Rendition.prototype.reportLocation = function(){
|
||||
return this.q.enqueue(function(){
|
||||
this.location = this.manager.currentLocation();
|
||||
this.trigger("locationChanged", this.location);
|
||||
var location = this.manager.currentLocation();
|
||||
if (location.then && typeof location.then === 'function') {
|
||||
location.then(function(result) {
|
||||
this.location = result;
|
||||
this.trigger("locationChanged", this.location);
|
||||
}.bind(this));
|
||||
} else {
|
||||
this.location = location;
|
||||
this.trigger("locationChanged", this.location);
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue