提交 85403856 编写于 作者: fxy060608's avatar fxy060608

feat(app): add sendNativeEvent,sendHostEvent

上级 b464a2f6
......@@ -6848,13 +6848,16 @@ var serviceContext = (function (vue) {
}, MakePhoneCallProtocol);
function requireNativePlugin(pluginName) {
/* eslint-disable no-undef */
if (typeof weex !== 'undefined') {
return weex.requireModule(pluginName);
}
/* eslint-disable no-undef */
return __requireNativePlugin__(pluginName);
}
}
function sendNativeEvent(event, data, callback) {
// 实时获取weex module(weex可能会变化,比如首页nvue加速显示时)
return requireNativePlugin('plus').sendNativeEvent(event, data, callback);
}
const sendHostEvent = sendNativeEvent;
const getClipboardData = defineAsyncApi(API_GET_CLIPBOARD_DATA, (_, { resolve, reject }) => {
const clipboard = requireNativePlugin('clipboard');
......@@ -12894,6 +12897,8 @@ var serviceContext = (function (vue) {
shareWithSystem: shareWithSystem,
requestPayment: requestPayment,
requireNativePlugin: requireNativePlugin,
sendNativeEvent: sendNativeEvent,
sendHostEvent: sendHostEvent,
__vuePlugin: index$1,
restoreGlobal: restoreGlobal,
createRewardedVideoAd: createRewardedVideoAd,
......
......@@ -2,10 +2,20 @@ declare const weex: any
declare const __requireNativePlugin__: any
export function requireNativePlugin(pluginName: string) {
/* eslint-disable no-undef */
if (typeof weex !== 'undefined') {
return weex.requireModule(pluginName)
}
/* eslint-disable no-undef */
return __requireNativePlugin__(pluginName)
}
export function sendNativeEvent(
event: string,
data: Record<string, any>,
callback: Function
) {
// 实时获取weex module(weex可能会变化,比如首页nvue加速显示时)
return requireNativePlugin('plus').sendNativeEvent(event, data, callback)
}
export const sendHostEvent = sendNativeEvent
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册