accounts: keep event emitter from closing when there are no accounts (#2636)

This commit is contained in:
link2xt
2021-08-29 18:43:58 +03:00
committed by GitHub
parent 7be0583628
commit 6a60ae2f09
2 changed files with 51 additions and 6 deletions

View File

@@ -62,6 +62,10 @@ impl Events {
pub struct EventEmitter(Receiver<Event>);
impl EventEmitter {
pub(crate) fn into_inner(self) -> Receiver<Event> {
self.0
}
/// Blocking recv of an event. Return `None` if the `Sender` has been droped.
pub fn recv_sync(&self) -> Option<Event> {
async_std::task::block_on(self.recv())