blob: ffb784d08d77334edb6db30afd8901bb7eccf8f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-- <event, {callbacks}>
local _broadcast = {}
local EventMsgCenter = {}
EventMsgCenter.registerMsg = function(e, callback)
if _broadcast[e] == nil then
_broadcast[e] = {}
end
table.insert(_broadcast[e], callback)
end
EventMsgCenter.unRegisterMsg = function(e, callback)
if _broadcast[e] == nil or callback == nil then
return
end
table.remove(_broadcast[e], callback)
end
EventMsgCenter.unRegisterAllMsgByEvent = function(e)
if _broadcast[e] == nil then
return
end
end
EventMsgCenter.unRegisterAllMsg = function()
end
EventMsgCenter.sendMsg = function(e, ...)
end
return EventMsgCenter
|