def register_listener(listener, event): nonlocal apply future_listener = FutureListener(listener, event) self._future_listeners.append(future_listener) if apply: self._apply_listener(future_listener) return listener
def register_listener(listener: ListenerType[Sanic], event: str) -> ListenerType[Sanic]: nonlocal apply future_listener = FutureListener(listener, event) self._future_listeners.append(future_listener) if apply: self._apply_listener(future_listener) return listener