Skip to content

Commit 14bc0ac

Browse files
committed
multiple subscribers
1 parent 2a4595e commit 14bc0ac

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/soda/events.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# Subscribe to an event
44
when() {
55
local event="${1//-/_}"
6-
local subscriber="${2//-/_}"
7-
log_debug "$subscriber subscribed to $event"
8-
append_to_var "SODA_EVENT_${event}" " $subscriber"
6+
shift
7+
for arg in $@; do
8+
local subscriber="${arg//-/_}"
9+
log_debug "$subscriber subscribed to $event"
10+
append_to_var "SODA_EVENT_${event}" " $subscriber"
11+
done
912
}
1013

1114
# Broadcast an event

0 commit comments

Comments
 (0)