1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Add event-emitter for node compatible events

This commit is contained in:
Fred Chasen 2016-10-26 23:49:57 +02:00
parent da8d7a97cc
commit a4e76029d4
9 changed files with 51 additions and 43 deletions

View file

@ -105,7 +105,7 @@ ContinuousViewManager.prototype.afterDisplayed = function(currView){
// this.removeShownListeners(currView);
// currView.onShown = this.afterDisplayed.bind(this);
this.trigger("added", currView.section);
this.emit("added", currView.section);
};
*/
@ -133,7 +133,7 @@ ContinuousViewManager.prototype.resize = function(width, height){
// this.rendition.display(this.location.start);
// }
this.trigger("resized", {
this.emit("resized", {
width: this.stage.width,
height: this.stage.height
});
@ -151,7 +151,7 @@ ContinuousViewManager.prototype.onResized = function(e) {
};
ContinuousViewManager.prototype.afterResized = function(view){
this.trigger("resize", view.section);
this.emit("resize", view.section);
};
// Remove Previous Listeners if present
@ -436,14 +436,14 @@ ContinuousViewManager.prototype.onScroll = function(){
this.scrollDeltaVert = 0;
this.scrollDeltaHorz = 0;
this.trigger("scroll", {
this.emit("scroll", {
top: scrollTop,
left: scrollLeft
});
clearTimeout(this.afterScrolled);
this.afterScrolled = setTimeout(function () {
this.trigger("scrolled", {
this.emit("scrolled", {
top: this.scrollTop,
left: this.scrollLeft
});