Skip to main content

WebViewDelegate

Trait WebViewDelegate 

Source
pub trait WebViewDelegate: Send + Sync {
    // Required methods
    fn on_page_started(&self);
    fn on_page_finished(&self);
    fn handle_post_message(&self, msg: String);
    fn log(&self, level: LogLevel, message: &str);

    // Provided method
    fn on_load_error(&self, _error: &LoadError) { ... }
}
Expand description

WebView delegate trait - focused on WebView events only

Required Methods§

Source

fn on_page_started(&self)

Called when the page starts loading

Source

fn on_page_finished(&self)

Called when the page finishes loading

Source

fn handle_post_message(&self, msg: String)

Handles a postMessage from the page View(WebView)

Source

fn log(&self, level: LogLevel, message: &str)

Receive log from WebView

Provided Methods§

Source

fn on_load_error(&self, _error: &LoadError)

Called when a main-frame page load fails (e.g. DNS failure, network unreachable, TLS error).

Only fires for the main document; sub-resource errors are ignored. Default is a no-op so existing implementations do not need to change.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§