1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 01:57:19 +00:00

Update hook mechanism so that multiple parameters can be passed

This commit is contained in:
Jermolene 2017-02-09 15:42:21 +00:00
parent 73ded6a82a
commit 6b2ab90721

View File

@ -2140,13 +2140,14 @@ $tw.hooks.addHook = function(hookName,definition) {
/*
Invoke the hook by key
*/
$tw.hooks.invokeHook = function(hookName, value) {
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
var args = Array.prototype.slice.call(arguments,1);
if($tw.utils.hop($tw.hooks.names,hookName)) {
for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
value = $tw.hooks.names[hookName][i](value);
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
}
}
return value;
return args[0];
};
/////////////////////////// Main boot function to decrypt tiddlers and then startup