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