From 214b53b3365c599b6babf8cceb7e23be48d775dc Mon Sep 17 00:00:00 2001 From: def Date: Mon, 4 Dec 2023 22:16:57 +0800 Subject: [PATCH] add comments --- examples/host_object.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/host_object.rs b/examples/host_object.rs index cd9ee8ca90..c9c14a7833 100644 --- a/examples/host_object.rs +++ b/examples/host_object.rs @@ -11,11 +11,11 @@ use wry::WebViewBuilder; #[cfg(target_os = "windows")] fn main() -> wry::Result<()> { - use wry::WebViewExtWindows; let event_loop = EventLoop::new(); let window = WindowBuilder::new().build(&event_loop).unwrap(); + use wry::WebViewExtWindows; use windows::{ core::{w, BSTR}, Win32::{ @@ -30,6 +30,8 @@ fn main() -> wry::Result<()> { } }; use std::mem::ManuallyDrop; + + // This is a simple usage example. add_host_object_to_script is a mapping of the native [addHostObjectToScript](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2#addhostobjecttoscript) method of webview2. It requires manual creation of hostobject and memory management. Please use it with caution. struct Variant(VARIANT); impl Variant { pub fn new(num: VARENUM, contents: VARIANT_0_0_0) -> Variant {