mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-01-20 19:41:32 -08:00
Merge da84d7b551 into ae4e99951a
This commit is contained in:
commit
208f972693
1 changed files with 5 additions and 0 deletions
|
|
@ -2735,7 +2735,12 @@ $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++) {
|
||||
var previousValue = args[0];
|
||||
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
|
||||
// Warn if a hook function forgets return when it is of pipe mode
|
||||
if(args[0] === undefined && previousValue !== undefined) {
|
||||
console.warn("Hook '" + hookName + "' handler at index " + i + " returned undefined. Expected the handler to return the value for the next hook in the chain. Handler function:", $tw.hooks.names[hookName][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return args[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue