Fix Windows build: AppHandle borrow, event lifetime, subscribe signature
This commit is contained in:
parent
3647f19b59
commit
fce171808e
|
|
@ -265,7 +265,7 @@ pub fn subscribe_event(
|
||||||
callback_id: String,
|
callback_id: String,
|
||||||
event_bus: State<'_, Arc<EventBus>>
|
event_bus: State<'_, Arc<EventBus>>
|
||||||
) -> Result<String, String> {
|
) -> Result<String, String> {
|
||||||
let id = event_bus.subscribe(&event_type, callback_id);
|
let id = event_bus.subscribe(event_type, callback_id);
|
||||||
Ok(id)
|
Ok(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,14 @@ impl EventBus {
|
||||||
|
|
||||||
pub fn subscribe(
|
pub fn subscribe(
|
||||||
&self,
|
&self,
|
||||||
event_type: &str,
|
event_type: String,
|
||||||
handler_id: String
|
handler_id: String
|
||||||
) -> SubscriptionId {
|
) -> SubscriptionId {
|
||||||
let id = Uuid::new_v4().to_string();
|
let id = Uuid::new_v4().to_string();
|
||||||
|
|
||||||
// Store subscription info - actual handler would be connected via frontend
|
// Store subscription info - actual handler would be connected via frontend
|
||||||
let mut subs = self.subscribers.lock().unwrap();
|
let mut subs = self.subscribers.lock().unwrap();
|
||||||
let handlers = subs.entry(event_type.to_string()).or_insert_with(Vec::new);
|
let handlers = subs.entry(event_type.clone()).or_insert_with(Vec::new);
|
||||||
|
|
||||||
// Create a handler that emits to frontend
|
// Create a handler that emits to frontend
|
||||||
let handler = Box::new(move |data: Value| {
|
let handler = Box::new(move |data: Value| {
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ fn main() {
|
||||||
window::setup_main_window(&main_window);
|
window::setup_main_window(&main_window);
|
||||||
|
|
||||||
// Create overlay window (hidden initially)
|
// Create overlay window (hidden initially)
|
||||||
window::create_overlay_window(app.handle());
|
window::create_overlay_window(&app.handle());
|
||||||
|
|
||||||
// Register default hotkeys
|
// Register default hotkeys
|
||||||
hotkey_manager.register_defaults();
|
hotkey_manager.register_defaults();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue