Capacitor plugin to render hidden webview, inject JS code and add message listeners.
npm install capacitor-hidden-webviewCapacitor plugin to render hidden webview, inject JS code and add message listeners.
``bash`
npm install capacitor-hidden-webview
npx cap sync
* create(...)
* evaluateJavascript(...)
* postMessage(...)
* destroy()
* addListener('webviewMessage' | 'webviewLoaded' | 'webviewError', ...)
* Interfaces
`typescript`
create(options: { url: string; injectScript?: string; }) => Promise
| Param | Type |
| ------------- | ---------------------------------------------------- |
| options | { url: string; injectScript?: string; } |
--------------------
`typescript`
evaluateJavascript(options: { js: string; }) => Promise<{ result?: any; }>
| Param | Type |
| ------------- | ---------------------------- |
| options | { js: string; } |
Returns: Promise<{ result?: any; }>
--------------------
`typescript`
postMessage(options: { message: any; }) => Promise
| Param | Type |
| ------------- | ------------------------------ |
| options | { message: any; } |
--------------------
`typescript`
destroy() => Promise
--------------------
`typescript`
addListener(eventName: 'webviewMessage' | 'webviewLoaded' | 'webviewError', listenerFunc: (data: { data: any; }) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------ |
| eventName | 'webviewMessage' \| 'webviewLoaded' \| 'webviewError' |
| listenerFunc | (data: { data: any; }) => void |
Returns: Promise<PluginListenerHandle>
--------------------
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove` | () => Promise<void> |