1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Switch to URI.js for url parsing, basic replacement for Archived urls

This commit is contained in:
fchasen 2015-12-06 22:14:02 -05:00
parent af5583191e
commit 13467128e5
18 changed files with 2677 additions and 207 deletions

View file

@ -14,8 +14,17 @@ function Hook(context){
};
// Adds a function to be run before a hook completes
Hook.prototype.register = function(func){
this.hooks.push(func);
Hook.prototype.register = function(){
for(var i = 0; i < arguments.length; ++i) {
if (typeof arguments[i] === "function") {
this.hooks.push(arguments[i]);
} else {
// unpack array
for(var j = 0; j < arguments[i].length; ++j) {
this.hooks.push(arguments[i][j]);
}
}
}
};
// Triggers a hook to run all functions
@ -38,4 +47,9 @@ Hook.prototype.trigger = function(){
return RSVP.all(promises);
};
// Adds a function to be run before a hook completes
Hook.prototype.list = function(){
return this.hooks;
};
module.exports = Hook;