@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.29 → 4.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
2
2
  import _display from '@ohos.display';
3
- import { Current, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, getCurrentInstance } from '@tarojs/runtime';
4
- import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
3
+ import { Current, eventCenter, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, getCurrentInstance } from '@tarojs/runtime';
4
+ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
5
5
  import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
6
6
  import deviceInfo from '@ohos.deviceInfo';
7
7
  import i18n from '@ohos.i18n';
8
8
  import errorManager from '@ohos.app.ability.errorManager';
9
+ import { eventCenter as eventCenter$1, Events, History } from '@tarojs/runtime/dist/runtime.esm';
9
10
  import sensor from '@ohos.sensor';
10
11
  import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
11
12
  import pasteboard from '@ohos.pasteboard';
@@ -22,6 +23,7 @@ import app from '@system.app';
22
23
  import file from '@system.file';
23
24
  import geoLocationManager from '@ohos.geoLocationManager';
24
25
  import mediaLibrary from '@ohos.multimedia.mediaLibrary';
26
+ import fs from '@ohos.file.fs';
25
27
  import picker from '@ohos.file.picker';
26
28
  import image from '@ohos.multimedia.image';
27
29
  import request$1 from '@ohos.request';
@@ -174,6 +176,21 @@ const validateParams = function (name, params, schema) {
174
176
  }
175
177
  };
176
178
 
179
+ function requestPermissions(permissions) {
180
+ return new Promise((resolve, reject) => {
181
+ const context = getContext(Current === null || Current === void 0 ? void 0 : Current.page);
182
+ const atManager = abilityAccessCtrl.createAtManager();
183
+ atManager.requestPermissionsFromUser(context, permissions, (err, _) => {
184
+ if (err) {
185
+ // eslint-disable-next-line prefer-promise-reject-errors
186
+ reject(`[Taro] 请求用户授权 ${permissions.join('、')} 失败:${JSON.stringify(err)}`);
187
+ }
188
+ else {
189
+ resolve();
190
+ }
191
+ });
192
+ });
193
+ }
177
194
  function object2String(obj) {
178
195
  let str = '';
179
196
  for (const item in obj) {
@@ -446,7 +463,7 @@ const launchOptions = {
446
463
  function initLaunchOptions(options = {}) {
447
464
  Object.assign(launchOptions, options);
448
465
  }
449
- eventCenter.once('__taroRouterLaunch', initLaunchOptions);
466
+ eventCenter$1.once('__taroRouterLaunch', initLaunchOptions);
450
467
  // 生命周期
451
468
  const getLaunchOptionsSync = () => launchOptions;
452
469
  const getEnterOptionsSync = () => launchOptions;
@@ -2262,20 +2279,20 @@ const chooseMedia = function (options) {
2262
2279
  });
2263
2280
  };
2264
2281
 
2282
+ const READ_IMAGEVIDEO_PERMISSIONS = 'ohos.permission.READ_IMAGEVIDEO';
2283
+ const READ_MEDIA_PERMISSIONS = 'ohos.permission.READ_MEDIA';
2284
+ const WRITE_MEDIA_PERMISSIONS = 'ohos.permission.WRITE_MEDIA';
2285
+ const MEDIA_LOCATION_PERMISSIONS = 'ohos.permission.MEDIA_LOCATION';
2286
+ const IMAGE_PERMISSION = [READ_IMAGEVIDEO_PERMISSIONS, READ_MEDIA_PERMISSIONS, WRITE_MEDIA_PERMISSIONS, MEDIA_LOCATION_PERMISSIONS];
2287
+
2265
2288
  // HarmonyOS 图片模块首批接口从API version 7开始支持。
2266
2289
  // HarmonyOS 文档链接:https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-image-0000001122977382
2267
2290
  // WX 文档链接:https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
2268
- // ✅ wx.getImageInfo(Object object) API7以上支持
2269
- // ✅ wx.compressImage(Object object) API7以上支持
2270
- // ✅ wx.chooseImage(Object object)
2271
- // ❌ wx.chooseMessageFile(Object object) HarmonyOS不支持
2272
- // ❌ wx.saveImageToPhotosAlbum(Object object) api 9+ HarmonyOS不支持
2273
- // ❌ wx.previewImage(Object object) api 9+ HarmonyOS不支持
2274
2291
  const getImageInfoSchema = {
2275
- url: 'String'
2292
+ src: 'String'
2276
2293
  };
2277
2294
  const compressImageSchema = {
2278
- url: 'String'
2295
+ src: 'String'
2279
2296
  };
2280
2297
  const chooseImageSchema = {
2281
2298
  count: 'Number'
@@ -2305,56 +2322,191 @@ const getImageInfo = function (options) {
2305
2322
  });
2306
2323
  });
2307
2324
  };
2308
- const compressImage = function (options) {
2309
- return new Promise((resolve, reject) => {
2325
+ class CompressedImageInfo {
2326
+ constructor() {
2327
+ this.imageUri = ''; // 压缩后图片保存位置的uri
2328
+ this.imageByteLength = 0; // 压缩后图片字节长度
2329
+ }
2330
+ }
2331
+ function saveImage(compressedImageData, compressedImageUri) {
2332
+ return __awaiter(this, void 0, void 0, function* () {
2333
+ const tempArr = compressedImageUri.split('/');
2334
+ const name = tempArr[tempArr.length - 1];
2335
+ const context = getContext(Current === null || Current === void 0 ? void 0 : Current.page);
2336
+ const applicationContext = context.getApplicationContext();
2337
+ const tempDir = applicationContext.tempDir;
2338
+ const filePath = `${tempDir}/${name}`;
2310
2339
  try {
2311
- validateParams('compressImage', options, compressImageSchema);
2340
+ const res = fs.accessSync(filePath);
2341
+ if (res) {
2342
+ // 如果图片afterCompressiona.jpeg已存在,则删除
2343
+ fs.unlinkSync(filePath);
2344
+ }
2312
2345
  }
2313
- catch (error) {
2314
- const res = { errMsg: error.message };
2346
+ catch (err) {
2347
+ console.error(`[Taro] saveImage Error: AccessSync failed with error message: ${err.message}, error code: ${err.code}`);
2348
+ }
2349
+ // 知识点:保存图片。获取最终图片压缩数据compressedImageData,保存图片。
2350
+ // 压缩图片数据写入文件
2351
+ const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
2352
+ fs.writeSync(file.fd, compressedImageData);
2353
+ fs.closeSync(file);
2354
+ // 获取压缩图片信息
2355
+ const compressedImageInfo = new CompressedImageInfo();
2356
+ compressedImageInfo.imageUri = filePath;
2357
+ compressedImageInfo.imageByteLength = compressedImageData.byteLength;
2358
+ return compressedImageInfo;
2359
+ });
2360
+ }
2361
+ const compressImage = function (options) {
2362
+ return new Promise((resolve, reject) => {
2363
+ requestPermissions(IMAGE_PERMISSION).then(() => {
2364
+ try {
2365
+ validateParams('compressImage', options, compressImageSchema);
2366
+ }
2367
+ catch (error) {
2368
+ const res = { errMsg: error.message };
2369
+ return callAsyncFail(reject, res, options);
2370
+ }
2371
+ const { src, quality = 80, compressedWidth, compressedHeight } = options;
2372
+ const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.');
2373
+ const file = fs.openSync(src, fs.OpenMode.READ_ONLY);
2374
+ // const stat = fs.statSync(file.fd)
2375
+ // console.log('[Taro] 压缩前图片的大小为:', stat.size)
2376
+ const source = image.createImageSource(file.fd);
2377
+ if (isNull(source)) {
2378
+ const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' };
2379
+ callAsyncFail(reject, createImageSourceError, options);
2380
+ return;
2381
+ }
2382
+ const width = source.getImageInfoSync().size.width;
2383
+ const height = source.getImageInfoSync().size.height;
2384
+ let wantWidth = compressedWidth || compressedHeight || 0;
2385
+ let wantHeight = compressedHeight || compressedWidth || 0;
2386
+ if (width > wantWidth || height > wantHeight) {
2387
+ const heightRatio = height / wantHeight;
2388
+ const widthRatio = width / wantWidth;
2389
+ const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio;
2390
+ wantWidth = Math.round(width / finalRatio);
2391
+ wantHeight = Math.round(height / finalRatio);
2392
+ }
2393
+ const decodingOptions = {
2394
+ editable: true,
2395
+ desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
2396
+ desiredSize: { width: wantWidth, height: wantHeight }
2397
+ };
2398
+ source.createPixelMap(decodingOptions, (error, pixelMap) => {
2399
+ if (error !== undefined) {
2400
+ fs.closeSync(file);
2401
+ const res = { errMsg: error };
2402
+ callAsyncFail(reject, res, options);
2403
+ }
2404
+ else {
2405
+ const packer = image.createImagePacker(file.fd);
2406
+ if (isNull(packer)) {
2407
+ fs.closeSync(file);
2408
+ const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' };
2409
+ callAsyncFail(reject, createImagePackerError, options);
2410
+ return;
2411
+ }
2412
+ const isPNG = src.endsWith('.png');
2413
+ const packingOptionsOHOS = {
2414
+ format: isPNG ? 'image/png' : 'image/jpeg',
2415
+ quality: quality
2416
+ };
2417
+ packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
2418
+ fs.closeSync(file);
2419
+ saveImage(value, srcAfterCompress).then(result => {
2420
+ callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options);
2421
+ });
2422
+ }).catch((error) => {
2423
+ fs.closeSync(file);
2424
+ callAsyncFail(reject, error, options);
2425
+ });
2426
+ }
2427
+ });
2428
+ }, (error) => {
2429
+ const res = { errMsg: error };
2315
2430
  return callAsyncFail(reject, res, options);
2316
- }
2317
- const { src, quality = 80 } = options;
2318
- const source = image.createImageSource(src);
2319
- if (isNull(source)) {
2320
- const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' };
2321
- callAsyncFail(reject, createImageSourceError, options);
2322
- return;
2323
- }
2324
- const packer = image.createImagePacker(src);
2325
- if (isNull(packer)) {
2326
- const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' };
2327
- callAsyncFail(reject, createImagePackerError, options);
2328
- }
2329
- const packingOptionsOHOS = {
2330
- // TODO:需要获取文件名后缀
2331
- format: 'image/jpeg',
2332
- quality: quality
2333
- };
2334
- packer.packing(source, packingOptionsOHOS).then((value) => {
2335
- callAsyncSuccess(resolve, value, options);
2336
- }).catch((error) => {
2337
- callAsyncFail(reject, error, options);
2338
2431
  });
2339
2432
  });
2340
2433
  };
2341
2434
  const chooseImage = function (options) {
2342
2435
  return new Promise((resolve, reject) => {
2343
- try {
2344
- validateParams('chooseImage', options, chooseImageSchema);
2345
- }
2346
- catch (error) {
2347
- const res = { errMsg: error.message };
2436
+ requestPermissions(IMAGE_PERMISSION).then(() => {
2437
+ try {
2438
+ validateParams('chooseImage', options, chooseImageSchema);
2439
+ }
2440
+ catch (error) {
2441
+ const res = { errMsg: error.message };
2442
+ return callAsyncFail(reject, res, options);
2443
+ }
2444
+ const { count = 9 } = options;
2445
+ const photoViewPicker = new picker.PhotoViewPicker();
2446
+ let sizeType = options.sizeType;
2447
+ if (!sizeType || !sizeType.length) {
2448
+ sizeType = ['compressed', 'original'];
2449
+ }
2450
+ photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2451
+ photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2452
+ photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2453
+ const result = {};
2454
+ const isOrigin = photoSelectResult.isOriginalPhoto;
2455
+ if (isOrigin) {
2456
+ const tempFilePaths = [];
2457
+ const tempFiles = photoSelectResult.photoUris.map(uri => {
2458
+ const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
2459
+ const stat = fs.statSync(file.fd);
2460
+ const size = stat.size;
2461
+ fs.closeSync(file);
2462
+ tempFilePaths.push(uri);
2463
+ return {
2464
+ size,
2465
+ path: uri,
2466
+ };
2467
+ });
2468
+ result.tempFiles = tempFiles;
2469
+ result.tempFilePaths = tempFilePaths;
2470
+ callAsyncSuccess(resolve, result, options);
2471
+ }
2472
+ else {
2473
+ const actions = photoSelectResult.photoUris.map(uri => {
2474
+ return new Promise(resolve => {
2475
+ compressImage({
2476
+ src: uri,
2477
+ compressedWidth: getSystemInfoSync().screenWidth / 2,
2478
+ compressedHeight: getSystemInfoSync().screenHeight / 2,
2479
+ success: (compressResult) => {
2480
+ resolve(compressResult.tempFilePath);
2481
+ }
2482
+ });
2483
+ });
2484
+ });
2485
+ Promise.all(actions).then(tempFilePaths => {
2486
+ const tempFiles = tempFilePaths.map(uri => {
2487
+ const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
2488
+ const stat = fs.statSync(file.fd);
2489
+ const size = stat.size;
2490
+ fs.closeSync(file);
2491
+ return {
2492
+ size,
2493
+ path: uri,
2494
+ };
2495
+ });
2496
+ result.tempFilePaths = tempFilePaths;
2497
+ result.tempFiles = tempFiles;
2498
+ callAsyncSuccess(resolve, result, options);
2499
+ }).catch(error => {
2500
+ const res = { errMsg: error };
2501
+ return callAsyncFail(reject, res, options);
2502
+ });
2503
+ }
2504
+ }).catch((error) => {
2505
+ callAsyncFail(reject, error, options);
2506
+ });
2507
+ }, (error) => {
2508
+ const res = { errMsg: error };
2348
2509
  return callAsyncFail(reject, res, options);
2349
- }
2350
- const { count = 9 } = options;
2351
- const photoViewPicker = new picker.PhotoViewPicker();
2352
- photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2353
- photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2354
- photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2355
- callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris }, options);
2356
- }).catch((error) => {
2357
- callAsyncFail(reject, error, options);
2358
2510
  });
2359
2511
  });
2360
2512
  };
@@ -3195,7 +3347,7 @@ const switchTab = (options) => {
3195
3347
  }
3196
3348
  if (((_a = stack[stack.length - 1]) === null || _a === void 0 ? void 0 : _a.path) === url) {
3197
3349
  // Note: 当前为 Tab 页时,触发 switch 事件
3198
- eventCenter.trigger('__taroSwitchTab', { url, params });
3350
+ eventCenter$1.trigger('__taroSwitchTab', { url, params });
3199
3351
  router.getLength() > 1 && router.clear();
3200
3352
  }
3201
3353
  else if (stack.some(item => item.path === url)) {
@@ -3620,7 +3772,7 @@ function setBackgroundColor(options) {
3620
3772
  const { success, fail, complete } = options || {};
3621
3773
  const handle = new MethodHandler({ name: 'setBackgroundColor', success, fail, complete });
3622
3774
  return new Promise((resolve, reject) => {
3623
- eventCenter.trigger('__taroPageStyle', {
3775
+ eventCenter$1.trigger('__taroPageStyle', {
3624
3776
  backgroundColor: options.backgroundColorBottom || options.backgroundColor,
3625
3777
  backgroundColorContext: options.backgroundColorTop || options.backgroundColor
3626
3778
  });
@@ -3767,7 +3919,7 @@ const setNavigationBarTitle = function (options) {
3767
3919
  const { success, fail, complete } = options || {};
3768
3920
  const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete });
3769
3921
  return new Promise((resolve, reject) => {
3770
- eventCenter.trigger('__taroNavigationStyle', {
3922
+ eventCenter$1.trigger('__taroNavigationStyle', {
3771
3923
  title: options.title,
3772
3924
  });
3773
3925
  return handle.success({}, { resolve, reject });
@@ -3777,7 +3929,7 @@ const setNavigationBarColor = function (options) {
3777
3929
  const { success, fail, complete } = options || {};
3778
3930
  const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete });
3779
3931
  return new Promise((resolve, reject) => {
3780
- eventCenter.trigger('__taroNavigationStyle', {
3932
+ eventCenter$1.trigger('__taroNavigationStyle', {
3781
3933
  animation: options.animation,
3782
3934
  backgroundColor: options.backgroundColor,
3783
3935
  frontColor: options.frontColor,
@@ -3789,7 +3941,7 @@ const showNavigationBarLoading = function (options) {
3789
3941
  const { success, fail, complete } = options || {};
3790
3942
  const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete });
3791
3943
  return new Promise((resolve, reject) => {
3792
- eventCenter.trigger('__taroNavigationStyle', {
3944
+ eventCenter$1.trigger('__taroNavigationStyle', {
3793
3945
  loading: true,
3794
3946
  });
3795
3947
  return handle.success({}, { resolve, reject });
@@ -3799,7 +3951,7 @@ const hideNavigationBarLoading = function (options) {
3799
3951
  const { success, fail, complete } = options || {};
3800
3952
  const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete });
3801
3953
  return new Promise((resolve, reject) => {
3802
- eventCenter.trigger('__taroNavigationStyle', {
3954
+ eventCenter$1.trigger('__taroNavigationStyle', {
3803
3955
  loading: false,
3804
3956
  });
3805
3957
  return handle.success({}, { resolve, reject });
@@ -3809,7 +3961,7 @@ const hideHomeButton = function (options) {
3809
3961
  const { success, fail, complete } = options || {};
3810
3962
  const handle = new MethodHandler({ name: 'hideHomeButton', success, fail, complete });
3811
3963
  return new Promise((resolve, reject) => {
3812
- eventCenter.trigger('__taroNavigationStyle', {
3964
+ eventCenter$1.trigger('__taroNavigationStyle', {
3813
3965
  home: false,
3814
3966
  });
3815
3967
  return handle.success({}, { resolve, reject });
@@ -3948,7 +4100,7 @@ const toggleTabBar = function (type) {
3948
4100
  else {
3949
4101
  const isShow = type === 'show';
3950
4102
  const event = isShow ? '__taroShowTabBar' : '__taroHideTabBar';
3951
- eventCenter.trigger(event, {
4103
+ eventCenter$1.trigger(event, {
3952
4104
  animation: options === null || options === void 0 ? void 0 : options.animation,
3953
4105
  });
3954
4106
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'isShowTaroTabBar', isShow);
@@ -3980,7 +4132,7 @@ const setTabBarStyle = function (options = {}) {
3980
4132
  data.backgroundColor = options.backgroundColor;
3981
4133
  if (options.borderStyle)
3982
4134
  data.borderStyle = options.borderStyle;
3983
- eventCenter.trigger('__taroSetTabBarStyle', options);
4135
+ eventCenter$1.trigger('__taroSetTabBarStyle', options);
3984
4136
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
3985
4137
  callAsyncSuccess(resolve, res, options);
3986
4138
  }
@@ -4012,7 +4164,7 @@ const setTabBarItem = function (options) {
4012
4164
  ...currentData.list.slice(index + 1)
4013
4165
  ];
4014
4166
  const data = Object.assign({}, currentData, { list });
4015
- eventCenter.trigger('__taroSetTabBarItem', options);
4167
+ eventCenter$1.trigger('__taroSetTabBarItem', options);
4016
4168
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
4017
4169
  callAsyncSuccess(resolve, res, options);
4018
4170
  }
@@ -4021,7 +4173,7 @@ const setTabBarItem = function (options) {
4021
4173
  function showTabBarRedDot(options) {
4022
4174
  const res = { errMsg: 'showTabBarRedDot:ok' };
4023
4175
  return new Promise((resolve) => {
4024
- eventCenter.trigger('__taroShowTabBarRedDotHandler', {
4176
+ eventCenter$1.trigger('__taroShowTabBarRedDotHandler', {
4025
4177
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4026
4178
  });
4027
4179
  callAsyncSuccess(resolve, res, options);
@@ -4030,7 +4182,7 @@ function showTabBarRedDot(options) {
4030
4182
  function hideTabBarRedDot(options) {
4031
4183
  const res = { errMsg: 'hideTabBarRedDot:ok' };
4032
4184
  return new Promise((resolve) => {
4033
- eventCenter.trigger('__taroHideTabBarRedDotHandler', {
4185
+ eventCenter$1.trigger('__taroHideTabBarRedDotHandler', {
4034
4186
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4035
4187
  });
4036
4188
  callAsyncSuccess(resolve, res, options);
@@ -4040,7 +4192,7 @@ function setTabBarBadge(options) {
4040
4192
  const res = { errMsg: 'setTabBarBadge:ok' };
4041
4193
  return new Promise((resolve) => {
4042
4194
  const text = (options === null || options === void 0 ? void 0 : options.text) || '';
4043
- eventCenter.trigger('__taroSetTabBarBadge', {
4195
+ eventCenter$1.trigger('__taroSetTabBarBadge', {
4044
4196
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4045
4197
  text: text.replace(/[\u0391-\uFFE5]/g, 'aa').length > 4 ? '...' : text,
4046
4198
  });
@@ -4050,7 +4202,7 @@ function setTabBarBadge(options) {
4050
4202
  function removeTabBarBadge(options) {
4051
4203
  const res = { errMsg: 'removeTabBarBadge:ok' };
4052
4204
  return new Promise((resolve) => {
4053
- eventCenter.trigger('__taroRemoveTabBarBadge', {
4205
+ eventCenter$1.trigger('__taroRemoveTabBarBadge', {
4054
4206
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4055
4207
  });
4056
4208
  callAsyncSuccess(resolve, res, options);
@@ -4546,7 +4698,7 @@ var apis = /*#__PURE__*/Object.freeze({
4546
4698
  disableAlertBeforeUnload: disableAlertBeforeUnload,
4547
4699
  downloadFile: downloadFile,
4548
4700
  enableAlertBeforeUnload: enableAlertBeforeUnload,
4549
- eventCenter: eventCenter,
4701
+ eventCenter: eventCenter$1,
4550
4702
  exitMiniProgram: exitMiniProgram,
4551
4703
  exitVoIPChat: exitVoIPChat,
4552
4704
  faceVerifyForPay: faceVerifyForPay,