saealib.CallbackManager#
- class saealib.CallbackManager[ソース]#
ベースクラス:
objectManages event handlers.
Handlers are registered per concrete event type and called in registration order when an event of that type is dispatched.
Methods
Invoke all handlers registered for the type of event. |
|
Register a handler for an event type. |
|
Replace a registered handler with another. |
|
Remove a previously registered handler. |
Method Details
- CallbackManager.dispatch(event)[ソース]#
Invoke all handlers registered for the type of event.
- パラメータ:
event (Event) -- The event object to dispatch. Handlers receive this object directly and may modify its mutable fields.
- 戻り値の型:
None
- CallbackManager.register(event_type, func)[ソース]#
Register a handler for an event type.
- パラメータ:
event_type (type[E]) -- The concrete event class to listen for.
func (Callable[[E], None]) -- Handler function. Receives the event object and returns nothing.
- 戻り値の型:
None
- CallbackManager.replace(event_type, old, new)[ソース]#
Replace a registered handler with another.
- パラメータ:
event_type (type[E]) -- The event class whose handler list to modify.
old (Callable[[E], None]) -- The handler to replace. Raises
ValueErrorif not found.new (Callable[[E], None]) -- The replacement handler.
- 戻り値の型:
None