mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
This commit is contained in:
committed by
GitHub
parent
b857a00679
commit
643ae846d8
5
.changes/fix-window-emit-target.md
Normal file
5
.changes/fix-window-emit-target.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Properly fill the origin window when using `emit_to` and `emit_all` from `Window`.
|
||||
@@ -520,7 +520,24 @@ impl<R: Runtime> PartialEq for Window<R> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for Window<R> {}
|
||||
impl<R: Runtime> Manager<R> for Window<R> {
|
||||
fn emit_to<S: Serialize + Clone>(
|
||||
&self,
|
||||
label: &str,
|
||||
event: &str,
|
||||
payload: S,
|
||||
) -> crate::Result<()> {
|
||||
self
|
||||
.manager()
|
||||
.emit_filter(event, Some(self.label()), payload, |w| label == w.label())
|
||||
}
|
||||
|
||||
fn emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> crate::Result<()> {
|
||||
self
|
||||
.manager()
|
||||
.emit_filter(event, Some(self.label()), payload, |_| true)
|
||||
}
|
||||
}
|
||||
impl<R: Runtime> ManagerBase<R> for Window<R> {
|
||||
fn manager(&self) -> &WindowManager<R> {
|
||||
&self.manager
|
||||
@@ -1339,6 +1356,7 @@ impl<R: Runtime> Window<R> {
|
||||
source_window_label: Option<&str>,
|
||||
payload: S,
|
||||
) -> crate::Result<()> {
|
||||
println!("emit internal {:?} {:?}", event, source_window_label);
|
||||
self.eval(&format!(
|
||||
"window['{}']({{event: {}, windowLabel: {}, payload: {}}})",
|
||||
self.manager.event_emit_function_name(),
|
||||
|
||||
Reference in New Issue
Block a user