From 6b2ab9072111cb87508f83a385b0885fb196cbcf Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 9 Feb 2017 15:42:21 +0000 Subject: [PATCH] Update hook mechanism so that multiple parameters can be passed --- boot/boot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 14c399c6b..f54b7dda4 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -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