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
-
stop_propagation
()[source]¶ Prevents the event from triggering any more event listeners.
This should be used within an event listener when you wish to halt any further listeners from being triggered.
-
stopped
¶ Return whether or not the event has been stopped.
-