@@ -498,6 +498,11 @@ pub(crate) mod sealed {
498498 Dispatch ( R :: Dispatcher ) ,
499499 }
500500
501+ #[ derive( Clone , serde:: Serialize ) ]
502+ struct WindowCreatedEvent {
503+ label : String ,
504+ }
505+
501506 /// Managed handle to the application runtime.
502507 pub trait ManagerBase < R : Runtime > {
503508 /// The manager behind the [`Managed`] item.
@@ -516,16 +521,22 @@ pub(crate) mod sealed {
516521 let pending = self
517522 . manager ( )
518523 . prepare_window ( self . app_handle ( ) , pending, & labels) ?;
519- match self . runtime ( ) {
520- RuntimeOrDispatch :: Runtime ( runtime) => runtime. create_window ( pending) . map_err ( Into :: into) ,
521- RuntimeOrDispatch :: RuntimeHandle ( handle) => {
522- handle. create_window ( pending) . map_err ( Into :: into)
523- }
524- RuntimeOrDispatch :: Dispatch ( mut dispatcher) => {
525- dispatcher. create_window ( pending) . map_err ( Into :: into)
526- }
524+ let window = match self . runtime ( ) {
525+ RuntimeOrDispatch :: Runtime ( runtime) => runtime. create_window ( pending) ,
526+ RuntimeOrDispatch :: RuntimeHandle ( handle) => handle. create_window ( pending) ,
527+ RuntimeOrDispatch :: Dispatch ( mut dispatcher) => dispatcher. create_window ( pending) ,
527528 }
528- . map ( |window| self . manager ( ) . attach_window ( self . app_handle ( ) , window) )
529+ . map ( |window| self . manager ( ) . attach_window ( self . app_handle ( ) , window) ) ?;
530+
531+ self . manager ( ) . emit_filter (
532+ "tauri://window-created" ,
533+ Some ( WindowCreatedEvent {
534+ label : window. label ( ) . into ( ) ,
535+ } ) ,
536+ |w| w != & window,
537+ ) ?;
538+
539+ Ok ( window)
529540 }
530541 }
531542}
0 commit comments