Module DruidEvent
Lua event small library
Functions
initialize(self, initial_callback) | Event constructur |
subscribe(self, callback, context) | Subscribe callback on event |
unsubscribe(self, callback, context) | Unsubscribe callback on event |
is_exist(self) | Return true, if event have at lease one handler |
clear(self) | Clear the all event handlers |
trigger(self, ...) | Trigger the event and call all subscribed callbacks |
Functions
- initialize(self, initial_callback)
-
Event constructur
Parameters:
- self DruidEvent
- initial_callback function Subscribe the callback on new event, if callback exist
- subscribe(self, callback, context)
-
Subscribe callback on event
Parameters:
- self DruidEvent
- callback function Callback itself
- context table Additional context as first param to callback call
- unsubscribe(self, callback, context)
-
Unsubscribe callback on event
Parameters:
- self DruidEvent
- callback function Callback itself
- context table Additional context as first param to callback call
- is_exist(self)
-
Return true, if event have at lease one handler
Parameters:
- self DruidEvent
Returns:
-
bool
True if event have handlers
- clear(self)
-
Clear the all event handlers
Parameters:
- self DruidEvent
- trigger(self, ...)
-
Trigger the event and call all subscribed callbacks
Parameters:
- self DruidEvent
- ... any All event params