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