diff --git a/packages/uni-app-plus/dist/uni-app-service.es.js b/packages/uni-app-plus/dist/uni-app-service.es.js index 788221a1bea389a34394b6a9ddae8cb1f69b8cf5..a653971915748411530407bbba31da5ded9ba20c 100644 --- a/packages/uni-app-plus/dist/uni-app-service.es.js +++ b/packages/uni-app-plus/dist/uni-app-service.es.js @@ -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, diff --git a/packages/uni-app-plus/src/service/api/plugin/requireNativePlugin.ts b/packages/uni-app-plus/src/service/api/plugin/requireNativePlugin.ts index fdca59d1e2fad69d47a24d59919b3c249e3b1e81..e57f8f2e6f6dbee4621945f6ac335b9cab1c464a 100644 --- a/packages/uni-app-plus/src/service/api/plugin/requireNativePlugin.ts +++ b/packages/uni-app-plus/src/service/api/plugin/requireNativePlugin.ts @@ -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, + callback: Function +) { + // 实时获取weex module(weex可能会变化,比如首页nvue加速显示时) + return requireNativePlugin('plus').sendNativeEvent(event, data, callback) +} + +export const sendHostEvent = sendNativeEvent