Skip to content

Commit f8b92b2

Browse files
committed
Assume msg.url if no cb is provided
1 parent b0808e6 commit f8b92b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ludobits/m/signal.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function M.create(signal_id)
99
local listeners = {}
1010

1111
function signal.add(cb)
12-
assert(cb, "You must provide a callback")
12+
cb = cb or msg.url()
1313
if type(cb) == "function" then
1414
listeners[cb] = { fn = cb }
1515
else
@@ -19,7 +19,7 @@ function M.create(signal_id)
1919
end
2020

2121
function signal.remove(cb)
22-
assert(cb, "You must provide a callback")
22+
cb = cb or msg.url()
2323
if type(cb) == "function" then
2424
listeners[cb] = nil
2525
else

0 commit comments

Comments
 (0)