mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Better loaderror handling
This commit is contained in:
parent
7c6fbfe978
commit
b1093fa841
4 changed files with 38 additions and 17 deletions
|
@ -166,12 +166,14 @@ class IframeView {
|
|||
resolve();
|
||||
});
|
||||
|
||||
}.bind(this), function(e){
|
||||
this.emit("loaderror", e);
|
||||
return new Promise((resolve, reject) => {
|
||||
reject(e);
|
||||
});
|
||||
}.bind(this))
|
||||
.then(function() {
|
||||
this.emit("rendered", this.section);
|
||||
}.bind(this))
|
||||
.catch(function(e){
|
||||
this.emit("loaderror", e);
|
||||
}.bind(this));
|
||||
|
||||
}
|
||||
|
@ -445,15 +447,18 @@ class IframeView {
|
|||
|
||||
if (!this.displayed) {
|
||||
|
||||
this.render(request).then(function () {
|
||||
this.render(request)
|
||||
.then(function () {
|
||||
|
||||
this.emit("displayed", this);
|
||||
this.onDisplayed(this);
|
||||
this.emit("displayed", this);
|
||||
this.onDisplayed(this);
|
||||
|
||||
this.displayed = true;
|
||||
displayed.resolve(this);
|
||||
this.displayed = true;
|
||||
displayed.resolve(this);
|
||||
|
||||
}.bind(this));
|
||||
}.bind(this), function (err) {
|
||||
displayed.reject(err, this);
|
||||
});
|
||||
|
||||
} else {
|
||||
displayed.resolve(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue