modify event register function name

This commit is contained in:
htl 2015-01-05 14:19:27 +08:00
parent d754900b28
commit c4cc6b5c34
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ function Event:unbind(target)
self:init_() self:init_()
end end
function Event:onEventListener(eventName, listener, tag) function Event:on(eventName, listener, tag)
assert(type(eventName) == "string" and eventName ~= "", assert(type(eventName) == "string" and eventName ~= "",
"Event:addEventListener() - invalid eventName") "Event:addEventListener() - invalid eventName")
eventName = string.upper(eventName) eventName = string.upper(eventName)
@ -50,7 +50,7 @@ function Event:onEventListener(eventName, listener, tag)
return self.target_, handle return self.target_, handle
end end
Event.addEventListener = Event.onEventListener Event.addEventListener = Event.on
function Event:dispatchEvent(event) function Event:dispatchEvent(event)
event.name = string.upper(tostring(event.name)) event.name = string.upper(tostring(event.name))