feat: per-entity navigate and reload requests (#21)
* feat: add per-entity navigate and reload methods Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * clippy --------- Co-authored-by: not-elm <elmgameinfo@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,25 @@ impl Browsers {
|
||||
}
|
||||
}
|
||||
|
||||
/// Navigate a specific webview to a new URL.
|
||||
pub fn navigate(&self, webview: &Entity, url: &str) {
|
||||
if let Some(browser) = self.browsers.get(webview)
|
||||
&& let Some(frame) = browser.client.main_frame()
|
||||
{
|
||||
frame.load_url(Some(&url.into()));
|
||||
}
|
||||
}
|
||||
|
||||
/// Reload a specific webview's current page.
|
||||
pub fn reload_webview(&self, webview: &Entity) {
|
||||
if let Some(browser) = self.browsers.get(webview)
|
||||
&& let Some(frame) = browser.client.main_frame()
|
||||
{
|
||||
let url = frame.url().into_string();
|
||||
frame.load_url(Some(&url.as_str().into()));
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the current zoom level for the specified webview.
|
||||
///
|
||||
/// ## Reference
|
||||
|
||||
Reference in New Issue
Block a user