Mountain/IPC/StatusReporter/InitializeStatusReporter.rs
1//! Bootstrap helper - construct the `StatusReporter::Reporter`
2//! and stash a clone in the app's Tauri state so the
3//! `mountain_*` Tauri commands can `try_state::<Reporter>()`.
4
5use std::sync::Arc;
6
7use tauri::Manager;
8
9use crate::{
10 IPC::StatusReporter::Reporter::Struct as Reporter,
11 RunTime::ApplicationRunTime::ApplicationRunTime,
12 dev_log,
13};
14
15pub fn initialize_status_reporter(app_handle:&tauri::AppHandle, runtime:Arc<ApplicationRunTime>) -> Result<(), String> {
16 dev_log!("lifecycle", "Initializing status reporter");
17
18 let reporter = Reporter::new(runtime);
19
20 app_handle.manage(reporter.clone_reporter());
21
22 Ok(())
23}