You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently .expect(...) is only for awaiting future events to be dispatched, but often you want to expect an event that might already have been dispatched. e.g.
defon_SwitchTabEvent(self, event: SwitchTabEvent):
...
ifno_tabs_open:
nav_event=awaitself.event_bus.dispatch(NavigateToUrlEvent(url='about:blank', new_tab=True))
# this event ^ synchronously creates the new tab, so by time we get to the next line below# TabCreatedEvent has already been dispatched and handled, so this doesn't work currently:# new_tab = self.event_bus.expect(TabCreatedEvent)new_tab=awaitself.event_bus.find_recent(TabCreatedEvent, child_of=nav_event)
We can potentially dedupe/merge this with the needs of EventBus.get_or_dispatch(...):