feat(gui): Preserve global state across page reloads (#48)

This commit is contained in:
binarybaron 2024-08-29 13:38:11 +02:00 committed by GitHub
parent c7c7cf1886
commit d913206062
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 11 deletions

View file

@ -1,14 +1,10 @@
/**
* TOOD: Perhaps we should move this to the `src-tauri` package.
*/
use crate::{monero, network::quote::BidQuote};
use anyhow::Result;
use bitcoin::Txid;
use serde::Serialize;
use typeshare::typeshare;
use uuid::Uuid;
use crate::{monero, network::quote::BidQuote};
static SWAP_PROGRESS_EVENT_NAME: &str = "swap-progress-update";
#[derive(Debug, Clone)]
@ -29,8 +25,8 @@ impl TauriHandle {
#[allow(unused_variables)]
pub fn emit_tauri_event<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()> {
#[cfg(tauri)]
self.0.emit(event, payload).map_err(|e| e.into())?;
#[cfg(feature = "tauri")]
tauri::Emitter::emit(self.0.as_ref(), event, payload).map_err(anyhow::Error::from)?;
Ok(())
}