1
0
Fork 0
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:
Fred Chasen 2017-11-03 13:41:39 -07:00
parent 7c6fbfe978
commit b1093fa841
4 changed files with 38 additions and 17 deletions

View file

@ -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);