Skip to main content

WKScriptMessageHandler

Trait WKScriptMessageHandler 

Source
pub unsafe trait WKScriptMessageHandler: NSObjectProtocol + MainThreadOnly {
    // Provided method
    unsafe fn userContentController_didReceiveScriptMessage(
        &self,
        user_content_controller: &WKUserContentController,
        message: &WKScriptMessage,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature WKScriptMessageHandler only.
Expand description

A class conforming to the WKScriptMessageHandler protocol provides a method for receiving messages from JavaScript running in a webpage.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn userContentController_didReceiveScriptMessage( &self, user_content_controller: &WKUserContentController, message: &WKScriptMessage, )
where Self: Sized + Message,

Available on crate features WKScriptMessage and WKUserContentController only.

Invoked when a script message is received from a webpage.

Parameter userContentController: The user content controller invoking the delegate method.

Parameter message: The script message received.

Trait Implementations§

Source§

impl<T> ImplementedBy<T> for dyn WKScriptMessageHandler

Source§

impl ProtocolType for dyn WKScriptMessageHandler

Source§

const NAME: &'static str = "WKScriptMessageHandler"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> WKScriptMessageHandler for ProtocolObject<T>

Implementors§