pub trait ICoreWebView2WebMessageReceivedEventArgs: IUnknown {
// Required methods
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;
}Expand description
Event args for the WebMessageReceived event.
Required Methods§
Sourceunsafe fn get_source(&self, source: *mut LPWSTR) -> HRESULT
unsafe fn get_source(&self, source: *mut LPWSTR) -> HRESULT
The URI of the document that sent this web message.
Sourceunsafe fn get_web_message_as_json(
&self,
web_message_as_json: *mut LPWSTR,
) -> HRESULT
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. Run this operation to communicate using JavaScript objects.
For example, the following postMessage runs result in the following
WebMessageAsJson values.
postMessage({'a': 'b'}) L"{\"a\": \"b\"}"
postMessage(1.2) L"1.2"
postMessage('example') L"\"example\""Sourceunsafe fn try_get_web_message_as_string(
&self,
web_message_as_string: *mut LPWSTR,
) -> HRESULT
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 returns the value of that string. If the message posted is some other kind of JavaScript type this method fails with the following error.
E_INVALIDARGRun this operation to communicate using simple strings.
For example, the following postMessage runs result in the following
WebMessageAsString values.
postMessage({'a': 'b'}) E_INVALIDARG
postMessage(1.2) E_INVALIDARG
postMessage('example') L"example"Trait Implementations§
Source§impl ComInterface for dyn ICoreWebView2WebMessageReceivedEventArgs
impl ComInterface for dyn ICoreWebView2WebMessageReceivedEventArgs
Source§const IID: IID = IID_ICORE_WEB_VIEW2_WEB_MESSAGE_RECEIVED_EVENT_ARGS
const IID: IID = IID_ICORE_WEB_VIEW2_WEB_MESSAGE_RECEIVED_EVENT_ARGS
The associated id for this interface
Source§type VTable = ICoreWebView2WebMessageReceivedEventArgsVTable
type VTable = ICoreWebView2WebMessageReceivedEventArgsVTable
A COM compatible V-Table
Source§fn is_iid_in_inheritance_chain(riid: &GUID) -> bool
fn is_iid_in_inheritance_chain(riid: &GUID) -> bool
Check whether a given IID is in the inheritance hierarchy of this interface