watson.events.types¶
- class watson.events.types.Event(name, target=None, params=None)[source]¶
A base event that can be subclassed for use with an EventDispatcher.
Example:
def my_listener(event): print(event.params['config']) dispatcher.add('MyEvent', my_listener) event = Event('MyEvent') event.params['config'] = {'some': 'config'} dispatcher.trigger(event)
- __init__(name, target=None, params=None)[source]¶
Initializes the event.
Initialize the Event based on an event name. The name will be used when the event is triggered from the event dispatcher.
Parameters: - name (string) – the name of the event
- target (mixed) – the originating target of the event
- params (dict) – the params associated with the event