#Events emitted on a specific window being emitted in other windows as well?

6 messages · Page 1 of 1 (latest)

solid grove
#

Hi team, I have a bit of a weird one, and not sure if it's up to Tauri or Angular on this one.

When we double click on our app icon in the system tray, it opens the app maximized and it navigates to the home route in Angular. The way we do this, is that we emit the 'navigate' event on the main window which runs the Angular router inside the zone and completes the navigation. However, even though we emit the event on the main window, we have a separate headless window active at the same time and for some reason the navigation is also triggered in that window. I'm going to post images of all the relevant code, but does anyone have any idea why this is behaving as such? It would make sense to me that the navigation triggers in the second window if we were to use emit_all on the app handle, but we're explicitly using emit on the main window, and pass the reference to the main window through the entire process. And also, every window should have it's own separate instance of the Angular application, so using Angular's router within the zone to navigate shouldn't be the issue?

lyric ridge
#

iirc event.listen listens to all events no matter where they are sent (not sure if that's actually intended), so maybe try window.listen instead

solid grove
#

@lyric ridge testing this now, but it's kind of weird to grasp, because even though event.listen might listen to all the events, the only window emitting the event should be the main window, and not our second one

lyric ridge
#

yeah, the event system is quite weird right now

solid grove
#

only if the listen part would run the code for all the active windows, instead of only running it in the window that sent the event initially

#

the good news is, what you wrote, fixed the issue, thank you so much!