@tb-app/web-view
Version:
实现webview与淘宝小程序之间的通信
21 lines (20 loc) • 716 B
TypeScript
import { Message } from './type';
declare type Callback = (data: any) => void;
/**
* 注册消息,只能在小程序端视频
* @param type 消息名称
* @param callback 回调
* @returns
*/
declare const registry: (type: string, callback: Callback) => void;
/**
* 自动注册所有小程序api(不包含事件监听和获取上下文之类API)
*/
declare function autoRegistry(): void;
/**
* 触发注册的消息, 只能在小程序端的web-view组件的 onMessage 处理函数上使用
* @param param 传给消息回调的数据
* @param webViewId web-view的id
*/
declare const trigger: (param: Message, webViewId: string) => void;
export { registry, trigger, autoRegistry };