UNPKG

para-bridge-demo

Version:

a bridge api for js-ios/andriod rest

35 lines (30 loc) 1.13 kB
import { BridgePlugin } from '../bridge'; interface ISetCategoryEventParam { eventType?: '1'; // 时事件类型 category: string; // '事件类别'; action: string; // '用户行为'; optLabel: string; // '记录的值名称'; optValue: string; // '资源id'; pagename?: string; // 'h5_test'; desc?: string; // '可不传递'; } export class SetCategoryEvent<K> extends BridgePlugin<ISetCategoryEventParam, K>{ protected get ntvPluginName() { return "_ntv_util_set_category_event"; } protected get availableMinVersion() { return "1.0.1"; } protected bridgeExecChrome(pluginName: string | undefined): void { // 可针对不同运行环境实现特定的调用逻辑来MOCK,弥补平台差异性. throw new Error('SetCategoryEvent() 未针对当前环境实现'); } }; /** * 动态事件提交 + 资源访问数据提交 数据平台已有的传参枚举值: * http://bps.17usoft.com/pages/viewpage.action?pageId=5904145 * @param param ISetCategoryEventParam */ export const setCategoryEvent = (param: ISetCategoryEventParam) => { new SetCategoryEvent<void>(param).invoke(); };