UNPKG

@tslsmart/magic-applet

Version:

特斯联移动端统一接口,抹平h5和wgt的差异

20 lines (19 loc) 619 B
export const action = (action) => { const { actionType, appid, targetUrl, data } = action; return new Promise((resolve, reject) => { if (actionType === 'navigate' && !appid) { reject('跳转应用必须传入目标应用的appid'); } else { try { uni.sendNativeEvent(actionType, { appid, targetUrl, data }, (e) => { resolve(e); console.log('wgt receive app params' + JSON.stringify(e)); }); } catch (e) { reject(e); } } }); };