mirror of
https://github.com/haexhub/haex-hub.git
synced 2025-12-16 14:10:52 +01:00
feat: Add event broadcasting to all webview extensions
- Added emit_to_all_extensions method to ExtensionWebviewManager - Implemented webview_extension_emit_to_all Tauri command - Updated UI store to broadcast context changes to webview extensions - Centralized event and method names using SDK constants - Updated all handlers to use HAEXTENSION_METHODS constants This enables proper context propagation (theme, locale, platform) to webview extensions.
This commit is contained in:
@ -305,14 +305,20 @@ impl ExtensionWebviewManager {
|
|||||||
reason: e.to_string(),
|
reason: e.to_string(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
eprintln!("[Manager] Emitting event '{}' to {} webview windows", event, windows.len());
|
||||||
|
|
||||||
// Iterate over all window IDs
|
// Iterate over all window IDs
|
||||||
for window_id in windows.keys() {
|
for window_id in windows.keys() {
|
||||||
|
eprintln!("[Manager] Trying to emit to window: {}", window_id);
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
if let Some(window) = app_handle.get_webview_window(window_id) {
|
if let Some(window) = app_handle.get_webview_window(window_id) {
|
||||||
// Emit event to this specific webview window
|
// Emit event to this specific webview window
|
||||||
if let Err(e) = window.emit(event, payload.clone()) {
|
match window.emit(event, payload.clone()) {
|
||||||
eprintln!("Failed to emit event {} to window {}: {}", event, window_id, e);
|
Ok(_) => eprintln!("[Manager] Successfully emitted event '{}' to window {}", event, window_id),
|
||||||
|
Err(e) => eprintln!("[Manager] Failed to emit event {} to window {}: {}", event, window_id, e),
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("[Manager] Window not found: {}", window_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user