@@ -34,7 +34,7 @@ use crate::{
3434 ipc:: { CommandArg , CommandItem , InvokeError , OwnedInvokeResponder } ,
3535 manager:: AppManager ,
3636 sealed:: { ManagerBase , RuntimeOrDispatch } ,
37- webview:: { Cookie , PageLoadPayload , WebviewBuilder } ,
37+ webview:: { Cookie , PageLoadPayload , WebviewBuilder , WebviewEvent } ,
3838 window:: WindowBuilder ,
3939 AppHandle , Event , EventId , Manager , Runtime , Webview , WindowEvent ,
4040} ;
@@ -1193,6 +1193,12 @@ impl<R: Runtime> AsRef<Webview<R>> for WebviewWindow<R> {
11931193 }
11941194}
11951195
1196+ impl < R : Runtime > AsRef < Window < R > > for WebviewWindow < R > {
1197+ fn as_ref ( & self ) -> & Window < R > {
1198+ & self . window
1199+ }
1200+ }
1201+
11961202impl < R : Runtime > Clone for WebviewWindow < R > {
11971203 fn clone ( & self ) -> Self {
11981204 Self {
@@ -1204,7 +1210,7 @@ impl<R: Runtime> Clone for WebviewWindow<R> {
12041210
12051211impl < R : Runtime > Eq for WebviewWindow < R > { }
12061212impl < R : Runtime > PartialEq for WebviewWindow < R > {
1207- /// Only use the [`Window `]'s label to compare equality.
1213+ /// Only use the [`Webview `]'s label to compare equality.
12081214 fn eq ( & self , other : & Self ) -> bool {
12091215 self . webview . eq ( & other. webview )
12101216 }
@@ -1269,6 +1275,11 @@ impl<R: Runtime> WebviewWindow<R> {
12691275 self . window . on_window_event ( f) ;
12701276 }
12711277
1278+ /// Registers a webview event listener.
1279+ pub fn on_webview_event < F : Fn ( & WebviewEvent ) + Send + ' static > ( & self , f : F ) {
1280+ self . webview . on_webview_event ( f) ;
1281+ }
1282+
12721283 /// Resolves the given command scope for this webview on the currently loaded URL.
12731284 ///
12741285 /// If the command is not allowed, returns None.
0 commit comments