Skip to main content

Mountain/IPC/StatusReporter/
InitializeStatusReporter.rs

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