@@ -34,7 +34,7 @@ use crate::{
34
34
ipc:: { CommandArg , CommandItem , InvokeError , OwnedInvokeResponder } ,
35
35
manager:: AppManager ,
36
36
sealed:: { ManagerBase , RuntimeOrDispatch } ,
37
- webview:: { Cookie , PageLoadPayload , WebviewBuilder } ,
37
+ webview:: { Cookie , PageLoadPayload , WebviewBuilder , WebviewEvent } ,
38
38
window:: WindowBuilder ,
39
39
AppHandle , Event , EventId , Manager , Runtime , Webview , WindowEvent ,
40
40
} ;
@@ -1193,6 +1193,12 @@ impl<R: Runtime> AsRef<Webview<R>> for WebviewWindow<R> {
1193
1193
}
1194
1194
}
1195
1195
1196
+ impl < R : Runtime > AsRef < Window < R > > for WebviewWindow < R > {
1197
+ fn as_ref ( & self ) -> & Window < R > {
1198
+ & self . window
1199
+ }
1200
+ }
1201
+
1196
1202
impl < R : Runtime > Clone for WebviewWindow < R > {
1197
1203
fn clone ( & self ) -> Self {
1198
1204
Self {
@@ -1204,7 +1210,7 @@ impl<R: Runtime> Clone for WebviewWindow<R> {
1204
1210
1205
1211
impl < R : Runtime > Eq for WebviewWindow < R > { }
1206
1212
impl < 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.
1208
1214
fn eq ( & self , other : & Self ) -> bool {
1209
1215
self . webview . eq ( & other. webview )
1210
1216
}
@@ -1269,6 +1275,11 @@ impl<R: Runtime> WebviewWindow<R> {
1269
1275
self . window . on_window_event ( f) ;
1270
1276
}
1271
1277
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
+
1272
1283
/// Resolves the given command scope for this webview on the currently loaded URL.
1273
1284
///
1274
1285
/// If the command is not allowed, returns None.
0 commit comments