Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions boot/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Loading