Events#
Hooks for connecting to run callback events.
- ratapi.events.clear(key=None, callback=None)#
Clear all event callbacks or specific callback.
- Parameters:
key (EventTypes, optional) – The event type of the callback to clear if given.
callback (Callable[[Union[str, PlotEventData, ProgressEventData]], None], optional) – A callback for an event which will be cleared if given.
- Return type:
None
- ratapi.events.get_event_callback(event_type)#
Return all callbacks registered for the given event type.
- Parameters:
event_type (EventTypes) – The event type.
- Returns:
callback – The callback for the event type.
- Return type:
Callable[[Union[str, PlotEventData, ProgressEventData]], None]
- ratapi.events.notify(event_type, data)#
Call registered callbacks with data when event type has been triggered.
- Parameters:
event_type (EventTypes) – The event type that was triggered.
data (str or PlotEventData or ProgressEventData) – The data sent by the event. The message event data is a string.
- Return type:
None
- ratapi.events.register(event_type, callback)#
Register a new callback for the event type.
- Parameters:
event_type (EventTypes) – The event type to register.
callback (Callable[[Union[str, PlotEventData, ProgressEventData]], None]) – The callback for when the event is triggered.
- Return type:
None