1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Pass through view listeners

This commit is contained in:
fchasen 2015-06-28 17:48:53 -04:00
parent 23d88d2e99
commit 4e566dde12
5 changed files with 157 additions and 79 deletions

View file

@ -26,6 +26,7 @@ EPUBJS.Rendition = function(book, options) {
this.hooks.show = new EPUBJS.Hook(this);
this.hooks.content.register(EPUBJS.replace.links.bind(this));
this.hooks.content.register(this.passViewEvents.bind(this));
// this.hooks.display.register(this.afterDisplay.bind(this));
@ -596,5 +597,15 @@ EPUBJS.Rendition.prototype.scrollTo = function(x, y, silent){
// };
};
EPUBJS.Rendition.prototype.passViewEvents = function(view){
view.listenedEvents.forEach(function(e){
view.on(e, this.triggerViewEvent.bind(this));
}.bind(this));
};
EPUBJS.Rendition.prototype.triggerViewEvent = function(e){
this.trigger(e.type, e);
};
//-- Enable binding events to Renderer
RSVP.EventTarget.mixin(EPUBJS.Rendition.prototype);