Skip to content

Commit

Permalink
Assume msg.url if no cb is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Sep 24, 2017
1 parent b0808e6 commit f8b92b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ludobits/m/signal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function M.create(signal_id)
local listeners = {}

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

function signal.remove(cb)
assert(cb, "You must provide a callback")
cb = cb or msg.url()
if type(cb) == "function" then
listeners[cb] = nil
else
Expand Down

0 comments on commit f8b92b2

Please sign in to comment.