Tried to access an unregistered event
Utility class for dispatching events to handlers.
Events have to be registered before they can be dispatched or have handlers added to them.
Handlers can have an owner associated with them, usually you’ll use the reference of the listener. This allows you to remove all the handlers of a specific owner, which should save you some work.
Class invariants: | |
---|---|
|
Add handler for an event, optionally with an owner.
Parameters: |
|
---|---|
Raises UnsupportedEventError: | |
when event_name doesn’t exist |
Dispatch an event to its handlers.
The handlers are executed in a random order.
Parameters: |
|
---|---|
Raises UnsupportedEventError: | |
if event_name doesn’t exist |
Register the decorated as a handler of event_name
Parameters: |
|
---|
Checks if event_name is supported
Parameters: | event_name (string) – name of the event |
---|---|
Returns: | True if the dispatcher has the event |
Register events.
Parameters: | event_names ((string...)) – names of events to support |
---|
Remove a handler from an event. It is an error to try to remove a handler from an event that doesn’t have this handler attached to it.
Parameters: |
|
---|---|
Preconditions : |
|
Raises UnsupportedEventError: | |
when event_name doesn’t exist |
Remove all or some handlers of the dispatcher.
event_name and owner act as filters of what to remove.
If no handler matched the criterea, the method will return silently.
Parameters: |
|
---|
Read-only, set of all supported events
Return type: | frozenset(string...) |
---|