Event Dispatchers¶
+A set of classes for dispatching events, they can be imported from fluid.utils.dispatcher
:
+
fluid.utils.dispatcher.BaseDispatcher
+
+
+¶
+
+
+
+ Bases: Generic[MessageType, MessageHandlerType]
, ABC
Source code in fluid/utils/dispatcher.py
+
+
+
fluid.utils.dispatcher.Dispatcher
+
+
+¶
+
+
+
+ Bases: BaseDispatcher[MessageType, Callable[[MessageType], None]]
Dispatcher for sync handlers
+ + + + + + +Source code in fluid/utils/dispatcher.py
+
+
+
register_handler
+
+
+¶
+
+
+ Source code in fluid/utils/dispatcher.py
+
+
unregister_handler
+
+
+¶
+
+
+
+
+
+
get_handlers
+
+
+¶
+
+
+
+
+
+
message_type
+
+
+
+ abstractmethod
+
+
+¶
+
+
+
+
+
+
dispatch
+
+
+¶
+
+
+ dispatch the message
+ + +
+
fluid.utils.dispatcher.AsyncDispatcher
+
+
+¶
+
+
+
+ Bases: BaseDispatcher[MessageType, Callable[[MessageType], Awaitable[None]]]
Dispatcher for async handlers
+ + + + + + +Source code in fluid/utils/dispatcher.py
+
+
+
register_handler
+
+
+¶
+
+
+ Source code in fluid/utils/dispatcher.py
+
+
unregister_handler
+
+
+¶
+
+
+
+
+
+
get_handlers
+
+
+¶
+
+
+
+
+
+
message_type
+
+
+
+ abstractmethod
+
+
+¶
+
+
+
+
+
+
dispatch
+
+
+
+ async
+
+
+¶
+
+
+ Dispatch the message and wait for all handlers to complete
+ +