[][src]Trait webview2_sys::ICoreWebView2WebMessageReceivedEventArgs

pub trait ICoreWebView2WebMessageReceivedEventArgs: IUnknown {
    unsafe fn get_source(&self, source: *mut LPWSTR) -> HRESULT;
unsafe fn get_web_message_as_json(
        &self,
        web_message_as_json: *mut LPWSTR
    ) -> HRESULT;
unsafe fn try_get_web_message_as_string(
        &self,
        web_message_as_string: *mut LPWSTR
    ) -> HRESULT; }

Event args for the WebMessageReceived event.

Required methods

unsafe fn get_source(&self, source: *mut LPWSTR) -> HRESULT

The URI of the document that sent this web message.

unsafe fn get_web_message_as_json(
    &self,
    web_message_as_json: *mut LPWSTR
) -> HRESULT

The message posted from the WebView content to the host converted to a JSON string. Use this to communicate via JavaScript objects.

For example the following postMessage calls result in the following WebMessageAsJson values:

   postMessage({'a': 'b'})      L"{\"a\": \"b\"}"
   postMessage(1.2)             L"1.2"
   postMessage('example')       L"\"example\""

unsafe fn try_get_web_message_as_string(
    &self,
    web_message_as_string: *mut LPWSTR
) -> HRESULT

If the message posted from the WebView content to the host is a string type, this method will return the value of that string. If the message posted is some other kind of JavaScript type this method will fail with E_INVALIDARG. Use this to communicate via simple strings.

For example the following postMessage calls result in the following WebMessageAsString values:

   postMessage({'a': 'b'})      E_INVALIDARG
   postMessage(1.2)             E_INVALIDARG
   postMessage('example')       L"example"
Loading content...

Trait Implementations

impl ComInterface for dyn ICoreWebView2WebMessageReceivedEventArgs[src]

type VTable = ICoreWebView2WebMessageReceivedEventArgsVTable

A COM compatible V-Table

type Super = dyn IUnknown

The interface that this interface inherits from

impl<C: ICoreWebView2WebMessageReceivedEventArgs> ProductionComInterface<C> for dyn ICoreWebView2WebMessageReceivedEventArgs[src]

Implementations on Foreign Types

impl<T: ICoreWebView2WebMessageReceivedEventArgs + ComInterface + ?Sized> ICoreWebView2WebMessageReceivedEventArgs for ComRc<T>[src]

impl<T: ICoreWebView2WebMessageReceivedEventArgs + ComInterface + ?Sized> ICoreWebView2WebMessageReceivedEventArgs for ComPtr<T>[src]

Loading content...

Implementors

Loading content...