aiwow-cap
v0.0.16
Published
For AileLite/Aiwow natvie
Readme
aiwow-cap
For aiwow natvie
Install
npm install aiwow-cap
npx cap syncAPI
echo(...)getAudioDevices()setAudioModeInCall()setAudioModeNormal()getRecentPhotos(...)getMediaByFolder(...)getMediaFolders(...)gotoSettings()getAssetData(...)open(...)clearCookies(...)clearAllCookies()clearCache()getCookies(...)close()openWebView(...)executeScript(...)postMessage(...)setUrl(...)addListener('urlChangeEvent', ...)addListener('buttonNearDoneClick', ...)addListener('closeEvent', ...)addListener('confirmBtnClicked', ...)addListener('messageFromWebview', ...)addListener('browserPageLoaded', ...)addListener('pageLoadError', ...)removeAllListeners()reload()- Interfaces
- Type Aliases
- Enums
echo(...)
echo(options: { value: string; }) => Promise<{ value: string; }>| Param | Type |
| ------------- | ------------------------------- |
| options | { value: string; } |
Returns: Promise<{ value: string; }>
getAudioDevices()
getAudioDevices() => Promise<AudioDevice>Returns: Promise<AudioDevice>
setAudioModeInCall()
setAudioModeInCall() => Promise<void>setAudioModeNormal()
setAudioModeNormal() => Promise<void>getRecentPhotos(...)
getRecentPhotos(options: { pageIndex: number; pageSize: number; }) => Promise<PhotosReturn>| Param | Type |
| ------------- | ----------------------------------------------------- |
| options | { pageIndex: number; pageSize: number; } |
Returns: Promise<PhotosReturn>
getMediaByFolder(...)
getMediaByFolder(options: { pageIndex: number; pageSize: number; }) => Promise<PhotosReturn>| Param | Type |
| ------------- | ----------------------------------------------------- |
| options | { pageIndex: number; pageSize: number; } |
Returns: Promise<PhotosReturn>
getMediaFolders(...)
getMediaFolders(options: { pageIndex: number; pageSize: number; folderPath: string; }) => Promise<PhotosFoldersReturn>| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options | { pageIndex: number; pageSize: number; folderPath: string; } |
Returns: Promise<PhotosFoldersReturn>
gotoSettings()
gotoSettings() => Promise<void>getAssetData(...)
getAssetData(options: { assetId: string; isOriginal: boolean; }) => Promise<any>| Param | Type |
| ------------- | ------------------------------------------------------ |
| options | { assetId: string; isOriginal: boolean; } |
Returns: Promise<any>
open(...)
open(options: OpenOptions) => Promise<any>| Param | Type |
| ------------- | --------------------------------------------------- |
| options | OpenOptions |
Returns: Promise<any>
clearCookies(...)
clearCookies(options: ClearCookieOptions) => Promise<any>Clear cookies of url
| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| options | ClearCookieOptions |
Returns: Promise<any>
Since: 0.5.0
clearAllCookies()
clearAllCookies() => Promise<any>Clear all cookies
Returns: Promise<any>
Since: 6.5.0
clearCache()
clearCache() => Promise<any>Clear cache
Returns: Promise<any>
Since: 6.5.0
getCookies(...)
getCookies(options: GetCookieOptions) => Promise<Record<string, string>>Get cookies for a specific URL.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------- | -------------------------------------------------- |
| options | GetCookieOptions | The options, including the URL to get cookies for. |
Returns: Promise<Record<string, string>>
close()
close() => Promise<any>Close the webview.
Returns: Promise<any>
openWebView(...)
openWebView(options: OpenWebViewOptions) => Promise<any>Open url in a new webview with toolbars
| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| options | OpenWebViewOptions |
Returns: Promise<any>
Since: 0.1.0
executeScript(...)
executeScript({ code }: { code: string; }) => Promise<void>Injects JavaScript code into the InAppBrowser window.
| Param | Type |
| --------- | ------------------------------ |
| __0 | { code: string; } |
postMessage(...)
postMessage(options: { detail: Record<string, any>; }) => Promise<void>Sends an event to the webview. you can listen to this event with addListener("messageFromWebview", listenerFunc: (event: Record<string, any>) => void) detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.
| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options | { detail: Record<string, any>; } |
setUrl(...)
setUrl(options: { url: string; }) => Promise<any>Sets the URL of the webview.
| Param | Type |
| ------------- | ----------------------------- |
| options | { url: string; } |
Returns: Promise<any>
addListener('urlChangeEvent', ...)
addListener(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>Listen for url change, only for openWebView
| Param | Type |
| ------------------ | --------------------------------------------------------------- |
| eventName | 'urlChangeEvent' |
| listenerFunc | UrlChangeListener |
Returns: Promise<PluginListenerHandle>
Since: 0.0.1
addListener('buttonNearDoneClick', ...)
addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ----------------------------------------------------------------- |
| eventName | 'buttonNearDoneClick' |
| listenerFunc | ButtonNearListener |
Returns: Promise<PluginListenerHandle>
addListener('closeEvent', ...)
addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle>Listen for close click only for openWebView
| Param | Type |
| ------------------ | --------------------------------------------------------------- |
| eventName | 'closeEvent' |
| listenerFunc | UrlChangeListener |
Returns: Promise<PluginListenerHandle>
Since: 0.4.0
addListener('confirmBtnClicked', ...)
addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle>Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS
| Param | Type |
| ------------------ | ----------------------------------------------------------------- |
| eventName | 'confirmBtnClicked' |
| listenerFunc | ConfirmBtnListener |
Returns: Promise<PluginListenerHandle>
Since: 0.0.1
addListener('messageFromWebview', ...)
addListener(eventName: 'messageFromWebview', listenerFunc: (event: { detail: Record<string, any>; }) => void) => Promise<PluginListenerHandle>Will be triggered when event is sent from webview, to send an event to the webview use window.mobileApp.postMessage({ "detail": { "message": "myMessage" } }) detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.
This method is inject at runtime in the webview
| Param | Type |
| ------------------ | --------------------------------------------------------------------------------------------- |
| eventName | 'messageFromWebview' |
| listenerFunc | (event: { detail: Record<string, any>; }) => void |
Returns: Promise<PluginListenerHandle>
addListener('browserPageLoaded', ...)
addListener(eventName: 'browserPageLoaded', listenerFunc: () => void) => Promise<PluginListenerHandle>Will be triggered when page is loaded
| Param | Type |
| ------------------ | -------------------------------- |
| eventName | 'browserPageLoaded' |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener('pageLoadError', ...)
addListener(eventName: 'pageLoadError', listenerFunc: () => void) => Promise<PluginListenerHandle>Will be triggered when page load error
| Param | Type |
| ------------------ | ---------------------------- |
| eventName | 'pageLoadError' |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Remove all listeners for this plugin.
Since: 1.0.0
reload()
reload() => Promise<any>Reload the current web page.
Returns: Promise<any>
Since: 1.0.0
Interfaces
AudioDevice
| Prop | Type |
| ------------------- | ---------------------------------------------------------- |
| inputDevices | { id: string; name: string; type: string; }[] |
| outputDevices | { id: string; name: string; type: string; }[] |
PhotosReturn
| Prop | Type |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| photos | { id: string; path: string; displayName: string; size: number; dateModified: number; mimeType: string; folderName?: string; duration?: number; thumbnailBase64?: number; }[] |
PhotosFoldersReturn
| Prop | Type |
| ------------ | ------------------------------------------------------------------------ |
| photos | { path: string; imageCount: string; videoCount: number; }[] |
OpenOptions
| Prop | Type | Description | Since |
| ---------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----- |
| url | string | Target URL to load. | 0.1.0 |
| headers | Headers | Headers to send with the request. | 0.1.0 |
| credentials | Credentials | Credentials to send with the request and all subsequent requests for the same host. | 6.1.0 |
| isPresentAfterPageLoad | boolean | if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately. | 0.1.0 |
| preventDeeplink | boolean | | |
Headers
Credentials
| Prop | Type |
| -------------- | ------------------- |
| username | string |
| password | string |
ClearCookieOptions
| Prop | Type |
| --------- | ------------------- |
| url | string |
HttpCookie
| Prop | Type | Description |
| ----------- | ------------------- | ------------------------ |
| url | string | The URL of the cookie. |
| key | string | The key of the cookie. |
| value | string | The value of the cookie. |
GetCookieOptions
| Prop | Type |
| --------------------- | -------------------- |
| url | string |
| includeHttpOnly | boolean |
OpenWebViewOptions
| Prop | Type | Description | Default | Since |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------ |
| url | string | 要加载的目标 URL 地址。 | | 0.1.0 |
| headers | Headers | 发送请求时携带的 header 信息。 | | 0.1.0 |
| credentials | Credentials | 发送请求和针对相同主机的后续所有请求时携带的凭据信息。 | | 6.1.0 |
| shareDisclaimer | DisclaimerOptions | 分享选项 | | 0.1.0 |
| toolbarType | ToolBarType | 工具栏类型 | ToolBarType.DEFAULT | 0.1.0 |
| shareSubject | string | 分享主题 | | 0.1.0 |
| title | string | 浏览器的标题 | '新窗口' | 0.1.0 |
| backgroundColor | BackgroundColor | 浏览器的背景颜色,仅限 iOS | BackgroundColor.BLACK | 0.1.0 |
| activeNativeNavigationForWebview | boolean | 如果为 true,则激活 webview 中的原生导航,仅限 Android | false | |
| disableGoBackOnNativeApplication | boolean | 禁用返回到原生应用的功能,可用于强制用户留在 webview 中,仅限 Android | false | |
| isPresentAfterPageLoad | boolean | 以新窗口全屏打开 URL isPresentAfterPageLoad: 如果为 true,则浏览器将在页面加载完成后呈现,如果为 false,则浏览器将立即呈现。 | false | 0.1.0 |
| isInspectable | boolean | 网站在 webview 中是否可被检查,仅限 ios | false | |
| isAnimated | boolean | webview 打开是否带有动画,仅限 ios | true | |
| showReloadButton | boolean | 显示一个重新加载网页的按钮 | false | 1.0.15 |
| closeModal | boolean | CloseModal: 如果为 true,当用户点击关闭按钮时会显示确认框,如果为 false,则浏览器将立即关闭。 | false | 1.1.0 |
| closeModalTitle | string | CloseModalTitle: 用户点击关闭按钮时的确认框标题,仅限 iOS | '关闭' | 1.1.0 |
| closeModalDescription | string | CloseModalDescription: 用户点击关闭按钮时的确认框描述,仅限 iOS | '您确定要关闭此窗口吗?' | 1.1.0 |
| closeModalOk | string | CloseModalOk: 用户点击关闭按钮时的确认按钮文本,仅限 iOS | '关闭' | 1.1.0 |
| closeModalCancel | string | CloseModalCancel: 用户点击关闭按钮时的取消按钮文本,仅限 iOS | '取消' | 1.1.0 |
| visibleTitle | boolean | visibleTitle: 如果为 true,则显示网站标题,否则为空 | true | 1.2.5 |
| toolbarColor | string | toolbarColor: 工具栏颜色,十六进制格式 | '#ffffff' | 1.2.5 |
| showArrow | boolean | showArrow: 如果为 true,则在关闭窗口时显示箭头而不是叉号。 | false | 1.2.5 |
| ignoreUntrustedSSLError | boolean | ignoreUntrustedSSLError: 如果为 true,则 webview 将忽略不受信任的 SSL 错误,允许用户查看网站 * | false | 6.1.0 |
| preShowScript | string | preShowScript: 如果 isPresentAfterPageLoad 为 true 并且设置了此变量,则插件将在显示浏览器之前注入一个脚本。此脚本将以异步方式运行。插件将等待脚本完成 (最多 10 秒)。 * | | 6.6.0 |
| buttonNearDone | { ios: { iconType: 'sf-symbol' | 'asset'; icon: string; }; android: { iconType: 'asset'; icon: string; width?: number; height?: number; }; } | buttonNearDone: 允许创建自定义按钮。有关详细信息,请参阅 buttonNearDone.md。 * | | 6.7.0 |
DisclaimerOptions
| Prop | Type |
| ---------------- | ------------------- |
| title | string |
| message | string |
| confirmBtn | string |
| cancelBtn | string |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
UrlEvent
| Prop | Type | Description | Since |
| --------- | ------------------- | ------------------------- | ----- |
| url | string | Emit when the url changes | 0.0.1 |
BtnEvent
| Prop | Type | Description | Since |
| --------- | ------------------- | ------------------------------ | ----- |
| url | string | Emit when a button is clicked. | 0.0.1 |
Type Aliases
ClearCookieOptions
Omit<HttpCookie, 'key' | 'value'>
Omit
Construct a type with the properties of T except for those in type K.
Pick<T, Exclude<keyof T, K>>
Pick
From T, pick a set of properties whose keys are in the union K
{ [P in K]: T[P]; }
Exclude
Exclude from T those types that are assignable to U
T extends U ? never : T
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
GetCookieOptions
Omit<HttpCookie, 'key' | 'value'>
UrlChangeListener
(state: UrlEvent): void
ButtonNearListener
(state: any): void
ConfirmBtnListener
(state: BtnEvent): void
Enums
ToolBarType
| Members | Value |
| ---------------- | ------------------------- |
| ACTIVITY | 'activity' |
| NAVIGATION | 'navigation' |
| BLANK | 'blank' |
| DEFAULT | '' |
BackgroundColor
| Members | Value |
| ----------- | -------------------- |
| WHITE | 'white' |
| BLACK | 'black' |
