UNPKG

wgappsdk

Version:

WarGaming App SDK for WebView communication

129 lines (128 loc) 6.26 kB
import { JumpMethod, JumpType, IJumpToShareScreenShotConfig, IJumpToShareImageConfig, IJumpToShareLinkConfig, ITitleBarStyle, IVibrate, ISelectItem, IModalBtn, AppNetMethod, IOrientation, IComment, IModal, ISelected, IListTop, IPushMessage, NetStatus, VibrateLevel, ShareType } from "./native"; export type { IJumpToShareScreenShotConfig, IJumpToShareImageConfig, IJumpToShareLinkConfig, ITitleBarStyle, IVibrate, ISelectItem, IModalBtn, IOrientation, IComment, IModal, ISelected, IListTop, IPushMessage }; export { JumpMethod, JumpType, AppNetMethod, NetStatus, VibrateLevel, ShareType }; /** * callNative 重载 */ /** 显示 webview 的页面的标题 */ export declare function callNative(jumpMethod: JumpMethod.SHOWTITLE, jumpConfig: { title: string; }): Promise<any>; /** 使用客户端打开一个网页,在当前网页,不重新打开一个 webview 窗口 */ export declare function callNative(jumpMethod: JumpMethod.OPENH5URL, jumpConfig: { url: string; }): Promise<any>; /** 委托客户端使用加密方式请求服务端,并把结果返回给 H5 */ export declare function callNative(jumpMethod: JumpMethod.ENCODECALLURLSYNC, jumpConfig: { appMethod: "get" | "post"; url: string; }): Promise<any>; /** 使用客户端输出网页 log */ export declare function callNative(jumpMethod: JumpMethod.SHOWH5LOG, jumpConfig: { url: string; }): Promise<any>; /** 获取当前网络状态,传入的参数如下,返回网络状态字符串:NONE, WIFI, 2G, 3G, 4G, 5G */ export declare function callNative(jumpMethod: JumpMethod.GETNETSTATUS): Promise<any>; /** 显示网络错误页面 */ export declare function callNative(jumpMethod: JumpMethod.SHOWNETERRORUI): Promise<any>; /** 显示 webview 的页面的小标题 */ export declare function callNative(jumpMethod: JumpMethod.SHOWSUBTITLE, jumpConfig: { title: string; }): Promise<any>; /** 通过客户端跳转一个页面,可以跳转到客户端指定的页面,如:坦克详情页、普通 webview 页面、战斗周报页面 */ export declare function callNative(jumpMethod: JumpMethod.JUMPTOUI, jumpConfig: { jump_type: JumpType; jump_data: string; }): Promise<any>; /** 通过客户端跳转分享 */ export declare function callNative(jumpMethod: JumpMethod.JUMPTOSHARE, jumpConfig: IJumpToShareScreenShotConfig | IJumpToShareImageConfig | IJumpToShareLinkConfig): Promise<any>; /** 通过客户端修改排行榜筛选页面顶部状态栏以及title栏的背景色值 */ export declare function callNative(jumpMethod: JumpMethod.JUMPTORANKFILTER, jumpConfig: { startColor: string; endColor: string; }): Promise<any>; /** 获取当前登录用户登录平台 */ export declare function callNative(jumpMethod: JumpMethod.GETCURUSERPLAT): Promise<any>; /** 调起当前登录页面 */ export declare function callNative(jumpMethod: JumpMethod.JUMPTOLOGIN): Promise<any>; /** 获取当前 app 版本信息 */ export declare function callNative(jumpMethod: JumpMethod.GETCURVERSION): Promise<any>; /** 修改 webview 的顶部 title 栏相关的 style */ export declare function callNative(jumpMethod: JumpMethod.TITLEBARSTYLEMOTIFY, jumpConfig: ITitleBarStyle): Promise<any>; /** 预览大图 */ export declare function callNative(jumpMethod: JumpMethod.JUMPIMAGEBROWSEPAGE, jumpConfig: { imageUrls: string; position: string; }): Promise<any>; /** 图片保存到本地 */ export declare function callNative(jumpMethod: JumpMethod.SAVEIMAGETOGALLERY, jumpConfig: { imagesUrl: string; }): Promise<any>; /** 关闭页面 */ export declare function callNative(jumpMethod: JumpMethod.FINISHWEB): Promise<any>; /** 调起 APP 输入框(资讯类) */ export declare function callNative(jumpMethod: JumpMethod.OPENINPUTVIEW, jumpConfig: { placeholder: string; min: number; max: number; }): Promise<any>; /** 调起 APP 输入框(论坛) */ export declare function callNative(jumpMethod: JumpMethod.OPENINPUTVIEWFORUM, jumpConfig: { placeholder: string; min: number; max: number; permission: "threadReply"; }): Promise<any>; /** 调起发帖编辑器(论坛) */ export declare function callNative(jumpMethod: JumpMethod.OPENEDITORFORUM, jumpConfig: { classify?: string; name?: string; id?: string; permission: "createThread"; }): Promise<any>; /** 获取社区绑定后的token,请求社区相关接口使用 */ export declare function callNative(jumpMethod: JumpMethod.GETCOMMUNITYTOKEN): Promise<any>; /** 编辑头像 */ export declare function callNative(jumpMethod: JumpMethod.EDITAVATARFORUM): Promise<any>; /** 振动 */ export declare function callNative(jumpMethod: JumpMethod.VIBRATE, jumpConfig?: IVibrate): Promise<any>; /** 获取系统信息 */ export declare function callNative(jumpMethod: JumpMethod.GETDEVICECONFIGURE): Promise<any>; /** 调起选择菜单 */ export declare function callNative(jumpMethod: JumpMethod.OPENSELECT, jumpConfig: { selectList: ISelectItem[]; [key: string]: any; }): Promise<any>; /** 调起模态框 */ export declare function callNative(jumpMethod: JumpMethod.OPENMODAL, jumpConfig: { title: string; subTitle: string; btnList: IModalBtn[]; }): Promise<any>; /** 打开视频播放页 */ export declare function callNative(jumpMethod: JumpMethod.VIDEOPLAYER, jumpConfig: { video_url: string; cover_url: string; title: string; }): Promise<any>; /** 广播消息到其他 webview */ export declare function callNative(jumpMethod: JumpMethod.PUSHMESSAGE, jumpConfig: { [key: string]: string | number | object; }): Promise<any>; /** 获取APP当前登录的用户信息 */ export declare function callNative(jumpMethod: JumpMethod.GETAPPUSERINFO): Promise<any>; /** 调起弹层 */ export declare function callNative(jumpMethod: JumpMethod.FULLDIALOG, jumpConfig: { url?: string; status: boolean; }): Promise<any>; /** 旋转屏幕 */ export declare function callNative(jumpMethod: JumpMethod.SETREQUESTEDORIENTATION, jumpConfig: { set: IOrientation; }): Promise<any>; type TMessage = IComment | ISelected | IModal | IPushMessage | IListTop; /** * 监听原生消息 * @param callback 回调函数 */ export declare function onAppMessage(callback: (appData: TMessage) => void): Promise<void>;