narupa.utilities.event module

class narupa.utilities.event.Event

Bases: object

A class which stores a set of callbacks, which are invoked when an event is published.

add_callback(callback: Callable[[...], None])

Add a callback to this event, which will be invoked everytime this event is invoked.

Parameters:callback – The callback to be called when this event is triggered
invoke(*args, **kwargs)

Invoke the callbacks associated with this event with the provided arguments.

Parameters:
  • args – Positional arguments for the event, passed on to each callback.
  • kwargs – Keywords arguments for the event, passed on to each callback.
remove_callback(callback: Callable[[...], None])

Remove a callback from this event.

Parameters:callback – The callback to be removed from this event’s callbacks