Skip to main content
Create a WebViewContext for communicating with web-view components.

Parameters

PropertyTypeRequiredDescription
webviewIdStringYesID of the web-view component

Return Value

Returns a WebViewContext object.

WebViewContext Methods

MethodDescription
postMessage(data)Send a message to the web-view

Code Example

const webViewContext = my.createWebViewContext('myWebView');

webViewContext.postMessage({
  action: 'refresh',
  data: { userId: '123' }
});
<web-view id="myWebView" src="https://example.com" onMessage="onWebViewMessage" />