pub struct BrowserWindowOwner(/* private fields */);
Expand description
An owned browser window handle.
When this handle goes out of scope, its resources will get scheduled for
cleanup. The resources will only ever be cleaned up whenever both this
handle has gone out of scope, and when the window has actually been closed
by the user. If the window has been closed by the user but this handle still
exists, the window is actually just been closed. It can be reshown by
calling show
on this handle.
Methods from Deref<Target = BrowserWindowHandle>§
Sourcepub fn app(&self) -> ApplicationHandle
pub fn app(&self) -> ApplicationHandle
Returns the application handle associated with this browser window.
Sourcepub async fn eval_js(&self, js: &str) -> Result<JsValue, JsEvaluationError>
pub async fn eval_js(&self, js: &str) -> Result<JsValue, JsEvaluationError>
Executes the given javascript code and returns the output as a string.
If you don’t need the result, see exec_js
.
There may be some discrepancies in what JS values are being returned for
the same code in different browser engines, or how accurate they are.
For example, Edge WebView2 doesn’t return JsValue::Undefined
, it uses
JsValue::Null
instead.
Sourcepub fn exec_js(&self, js: &str)
pub fn exec_js(&self, js: &str)
Executes the given javascript code without waiting on it to finish.
Causes the browser to navigate to the given url.
pub fn url<'a>(&'a self) -> Cow<'a, str>
pub fn window(&self) -> &WindowHandle
Methods from Deref<Target = WindowHandle>§
pub fn content_dimensions(&self) -> Dims2D
pub fn opacity(&self) -> u8
pub fn position(&self) -> Pos2D
pub fn title(&self) -> String
pub fn window_dimensions(&self) -> Dims2D
Sourcepub fn hide(&self)
pub fn hide(&self)
Hides the window. Keep in mind that hiding the window is not the same as closing it. Hiding the window will keep it’s resources alive. If the window is hidden, and all window handles are gone, the memory is effectively leaked.