Files
azerothcore-wotlk/deps/hw-core/bash-lib-event/src/hooks.sh
Yehonal f06f32849f Directory Structure [step 1]: moving files
working on #672

NOTE: This commit can't be compiled!!
2017-10-12 20:00:52 +02:00

17 lines
334 B
Bash

# par 1: hook_name
function hwc_event_run_hooks() {
hook_name="HOOKS_MAP_$1"
read -r -a SRCS <<< ${!hook_name}
echo "Running hooks: $hook_name"
for i in "${SRCS[@]}"
do
$i # run registered hook
done
}
function hwc_event_register_hooks() {
hook_name="HOOKS_MAP_$1"
hooks=${@:2}
declare -g "$hook_name+=$hooks "
}