Trigger the event and notify all listeners with the given `result`.
(self, result)
| 48 | self._listeners = [] |
| 49 | |
| 50 | def trigger(self, result): |
| 51 | """ |
| 52 | Trigger the event and notify all listeners with the given `result`. |
| 53 | """ |
| 54 | for listener in self._listeners: |
| 55 | if is_awaitable(listener): |
| 56 | asyncio.create_task(listener(result)) |
| 57 | else: |
| 58 | listener(result) |
| 59 | |
| 60 | def add_listener(self, listener): |
| 61 | """ |