euporie.core.terminal.Event

class euporie.core.terminal.Event(sender: prompt_toolkit.utils._Sender, handler: Optional[Callable[[prompt_toolkit.utils._Sender], None]] = None)

Simple event to which event handlers can be attached. For instance:

class Cls:
    def __init__(self):
        # Define event. The first parameter is the sender.
        self.event = Event(self)

obj = Cls()

def handler(sender):
    pass

# Add event handler by using the += operator.
obj.event += handler

# Fire event.
obj.event()