@tarojs/taro-h5 3.3.20 → 3.4.0-beta.3

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.
Files changed (125) hide show
  1. package/dist/api/ad/index.js +1 -0
  2. package/dist/api/ai/facial.js +1 -0
  3. package/dist/api/ai/visual.js +1 -0
  4. package/dist/api/alipay/index.js +1 -0
  5. package/dist/api/base/crypto.js +1 -0
  6. package/dist/api/base/index.js +1 -0
  7. package/dist/api/base/performance.js +1 -0
  8. package/dist/api/base/system/info.js +1 -0
  9. package/dist/api/base/system/network.js +12 -1
  10. package/dist/api/base/update.js +1 -0
  11. package/dist/api/base/weapp/app-event.js +1 -0
  12. package/dist/api/base/weapp/life-cycle.js +1 -0
  13. package/dist/api/canvas/CanvasContext.js +9 -0
  14. package/dist/api/canvas/canvasGetImageData.js +4 -0
  15. package/dist/api/canvas/canvasPutImageData.js +5 -0
  16. package/dist/api/canvas/canvasToTempFilePath.js +4 -0
  17. package/dist/api/canvas/createCanvasContext.js +3 -0
  18. package/dist/api/canvas/index.js +1 -0
  19. package/dist/api/cloud/index.js +3 -0
  20. package/dist/api/device/accelerometer.js +12 -0
  21. package/dist/api/device/accessibility.js +1 -0
  22. package/dist/api/device/battery.js +1 -0
  23. package/dist/api/device/bluetooth-ble.js +1 -0
  24. package/dist/api/device/bluetooth-peripheral.js +1 -0
  25. package/dist/api/device/bluetooth.js +1 -0
  26. package/dist/api/device/calendar.js +1 -0
  27. package/dist/api/device/clipboard.js +17 -0
  28. package/dist/api/device/compass.js +12 -0
  29. package/dist/api/device/contact.js +1 -0
  30. package/dist/api/device/crypto.js +1 -0
  31. package/dist/api/device/gyroscope.js +1 -0
  32. package/dist/api/device/iBeacon.js +1 -0
  33. package/dist/api/device/keyboard.js +1 -0
  34. package/dist/api/device/memory.js +1 -0
  35. package/dist/api/device/motion.js +12 -0
  36. package/dist/api/device/nfc.js +1 -0
  37. package/dist/api/device/phone.js +1 -0
  38. package/dist/api/device/scan.js +1 -0
  39. package/dist/api/device/screen.js +1 -0
  40. package/dist/api/device/vibrate.js +6 -0
  41. package/dist/api/device/wifi.js +1 -0
  42. package/dist/api/ext/index.js +1 -0
  43. package/dist/api/files/index.js +1 -0
  44. package/dist/api/framework/index.js +1 -0
  45. package/dist/api/location/chooseLocation.js +5 -0
  46. package/dist/api/location/index.js +1 -0
  47. package/dist/api/media/audio/index.js +7 -0
  48. package/dist/api/media/background-audio.js +1 -0
  49. package/dist/api/media/camera.js +1 -0
  50. package/dist/api/media/editor.js +1 -0
  51. package/dist/api/media/image/chooseImage.js +4 -0
  52. package/dist/api/media/image/getImageInfo.js +4 -0
  53. package/dist/api/media/image/index.js +1 -0
  54. package/dist/api/media/image/previewImage.js +10 -0
  55. package/dist/api/media/live.js +1 -0
  56. package/dist/api/media/map.js +1 -0
  57. package/dist/api/media/media-recorder.js +1 -0
  58. package/dist/api/media/recorder.js +1 -0
  59. package/dist/api/media/video/index.js +9 -0
  60. package/dist/api/media/video-decoder.js +1 -0
  61. package/dist/api/media/video-processing.js +1 -0
  62. package/dist/api/media/voip.js +1 -0
  63. package/dist/api/navigate/index.js +1 -0
  64. package/dist/api/network/download.js +23 -0
  65. package/dist/api/network/mdns.js +1 -0
  66. package/dist/api/network/request/index.js +2 -0
  67. package/dist/api/network/tcp.js +1 -0
  68. package/dist/api/network/udp.js +1 -0
  69. package/dist/api/network/upload.js +22 -0
  70. package/dist/api/network/utils.js +36 -1
  71. package/dist/api/network/websocket/index.js +5 -0
  72. package/dist/api/network/websocket/socketTask.js +2 -0
  73. package/dist/api/open-api/account.js +1 -0
  74. package/dist/api/open-api/address.js +1 -0
  75. package/dist/api/open-api/authorize.js +1 -0
  76. package/dist/api/open-api/card.js +1 -0
  77. package/dist/api/open-api/channels-live.js +1 -0
  78. package/dist/api/open-api/customer-service.js +1 -0
  79. package/dist/api/open-api/facial.js +1 -0
  80. package/dist/api/open-api/favorites.js +1 -0
  81. package/dist/api/open-api/group.js +1 -0
  82. package/dist/api/open-api/invoice.js +1 -0
  83. package/dist/api/open-api/license-plate.js +1 -0
  84. package/dist/api/open-api/login.js +1 -0
  85. package/dist/api/open-api/red-package.js +1 -0
  86. package/dist/api/open-api/settings.js +1 -0
  87. package/dist/api/open-api/soter.js +1 -0
  88. package/dist/api/open-api/subscribe-message.js +1 -0
  89. package/dist/api/open-api/user-info.js +1 -0
  90. package/dist/api/open-api/werun.js +1 -0
  91. package/dist/api/payment/index.js +1 -0
  92. package/dist/api/route/index.js +2 -0
  93. package/dist/api/share/index.js +1 -0
  94. package/dist/api/storage/background-fetch.js +1 -0
  95. package/dist/api/storage/index.js +5 -0
  96. package/dist/api/swan/index.js +4 -0
  97. package/dist/api/taro.js +6 -18
  98. package/dist/api/ui/animation/index.js +34 -0
  99. package/dist/api/ui/background.js +1 -0
  100. package/dist/api/ui/custom-component.js +1 -0
  101. package/dist/api/ui/fonts.js +1 -0
  102. package/dist/api/ui/interaction/actionSheet.js +16 -0
  103. package/dist/api/ui/interaction/index.js +9 -4
  104. package/dist/api/ui/interaction/modal.js +22 -0
  105. package/dist/api/ui/interaction/toast.js +16 -0
  106. package/dist/api/ui/menu.js +1 -0
  107. package/dist/api/ui/navigation-bar/index.js +5 -0
  108. package/dist/api/ui/pull-down-refresh.js +6 -0
  109. package/dist/api/ui/scroll/index.js +3 -0
  110. package/dist/api/ui/sticky.js +1 -0
  111. package/dist/api/ui/tab-bar.js +32 -0
  112. package/dist/api/ui/window.js +9 -0
  113. package/dist/api/utils/handler.js +16 -0
  114. package/dist/api/utils/index.js +7 -0
  115. package/dist/api/worker/index.js +1 -0
  116. package/dist/api/wxml/selectorQuery.js +13 -0
  117. package/dist/index.cjs.js +637 -160
  118. package/dist/index.js +2 -2
  119. package/package.json +9 -13
  120. package/src/api/media/image/previewImage.ts +1 -1
  121. package/src/api/taro.ts +4 -48
  122. package/src/api/ui/interaction/index.ts +6 -4
  123. package/src/api/ui/navigation-bar/index.ts +1 -1
  124. package/src/api/ui/scroll/index.ts +1 -1
  125. package/src/index.ts +2 -2
package/dist/index.cjs.js CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var Taro = _interopDefault(require('@tarojs/api'));
5
+ var Taro = require('@tarojs/api');
8
6
  var router = require('@tarojs/router');
9
7
  var runtime = require('@tarojs/runtime');
10
8
 
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var Taro__default = /*#__PURE__*/_interopDefaultLegacy(Taro);
12
+
13
+ /* eslint-disable prefer-promise-reject-errors */
11
14
  function shouldBeObject(target) {
12
15
  if (target && typeof target === 'object')
13
16
  return { flag: true };
@@ -69,7 +72,7 @@ function setTransform(el, val) {
69
72
  el.style.webkitTransform = val;
70
73
  el.style.transform = val;
71
74
  }
72
- function serializeParams(params) {
75
+ function serializeParams$1(params) {
73
76
  if (!params) {
74
77
  return '';
75
78
  }
@@ -106,7 +109,7 @@ function permanentlyNotSupport(apiName) {
106
109
  });
107
110
  };
108
111
  }
109
- function isFunction(obj) {
112
+ function isFunction$1(obj) {
110
113
  return typeof obj === 'function';
111
114
  }
112
115
  const VALID_COLOR_REG = /^#[0-9a-fA-F]{6}$/;
@@ -114,6 +117,7 @@ const isValidColor = (color) => {
114
117
  return VALID_COLOR_REG.test(color);
115
118
  };
116
119
  function processOpenApi(apiName, defaultOptions, formatResult = res => res, formatParams = options => options) {
120
+ // @ts-ignore
117
121
  if (!window.wx) {
118
122
  return weixinCorpSupport(apiName);
119
123
  }
@@ -133,11 +137,16 @@ function processOpenApi(apiName, defaultOptions, formatResult = res => res, form
133
137
  }
134
138
  };
135
139
  });
140
+ // @ts-ignore
136
141
  wx[apiName](formatParams(obj));
137
142
  });
138
143
  return p;
139
144
  };
140
145
  }
146
+ /**
147
+ * ease-in-out的函数
148
+ * @param t 0-1的数字
149
+ */
141
150
  const easeInOut = (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
142
151
  const getTimingFunc = (easeFunc, frameCnt) => {
143
152
  return x => {
@@ -149,20 +158,58 @@ const getTimingFunc = (easeFunc, frameCnt) => {
149
158
  };
150
159
  };
151
160
 
161
+ // 广告
152
162
  const createRewardedVideoAd = temporarilyNotSupport('createRewardedVideoAd');
153
163
  const createInterstitialAd = temporarilyNotSupport('createInterstitialAd');
154
164
 
165
+ // 人脸识别
155
166
  const stopFaceDetect = temporarilyNotSupport('stopFaceDetect');
156
167
  const initFaceDetect = temporarilyNotSupport('initFaceDetect');
157
168
  const faceDetect = temporarilyNotSupport('faceDetect');
158
169
 
170
+ // 视觉算法
159
171
  const createVKSession = temporarilyNotSupport('createVKSession');
160
172
 
173
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
174
+
175
+ function getDefaultExportFromCjs (x) {
176
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
177
+ }
178
+
179
+ function getDefaultExportFromNamespaceIfPresent (n) {
180
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
181
+ }
182
+
183
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
184
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
185
+ }
186
+
187
+ function getAugmentedNamespace(n) {
188
+ if (n.__esModule) return n;
189
+ var a = Object.defineProperty({}, '__esModule', {value: true});
190
+ Object.keys(n).forEach(function (k) {
191
+ var d = Object.getOwnPropertyDescriptor(n, k);
192
+ Object.defineProperty(a, k, d.get ? d : {
193
+ enumerable: true,
194
+ get: function () {
195
+ return n[k];
196
+ }
197
+ });
198
+ });
199
+ return a;
200
+ }
201
+
202
+ function commonjsRequire (path) {
203
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
204
+ }
205
+
206
+ var base64Js = {};
207
+
161
208
  'use strict';
162
209
 
163
- var byteLength_1 = byteLength;
164
- var toByteArray_1 = toByteArray;
165
- var fromByteArray_1 = fromByteArray;
210
+ var byteLength_1 = base64Js.byteLength = byteLength;
211
+ var toByteArray_1 = base64Js.toByteArray = toByteArray;
212
+ var fromByteArray_1 = base64Js.fromByteArray = fromByteArray;
166
213
  var lookup = [];
167
214
  var revLookup = [];
168
215
  var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
@@ -278,31 +325,9 @@ function fromByteArray(uint8) {
278
325
  return parts.join('');
279
326
  }
280
327
 
281
- var base64Js = {
282
- byteLength: byteLength_1,
283
- toByteArray: toByteArray_1,
284
- fromByteArray: fromByteArray_1
285
- };
286
-
287
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
288
-
289
- function commonjsRequire () {
290
- throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
291
- }
292
-
293
- function unwrapExports (x) {
294
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
295
- }
296
-
297
- function createCommonjsModule(fn, module) {
298
- return module = { exports: {} }, fn(module, module.exports), module.exports;
299
- }
300
-
301
- function getCjsExportFromNamespace (n) {
302
- return n && n['default'] || n;
303
- }
328
+ var mobileDetect = {exports: {}};
304
329
 
305
- var mobileDetect = createCommonjsModule(function (module) {
330
+ (function (module) {
306
331
  // THIS FILE IS GENERATED - DO NOT EDIT!
307
332
 
308
333
  /*!mobile-detect v1.4.5 2021-03-13*/
@@ -847,27 +872,16 @@ var mobileDetect = createCommonjsModule(function (module) {
847
872
  var $isMobile = t.mobile() !== null;
848
873
 
849
874
  if ( // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1)
850
- t.os('iOS') && t.version('iPad') >= 4.3 || t.os('iOS') && t.version('iPhone') >= 3.1 || t.os('iOS') && t.version('iPod') >= 3.1 || // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)
851
- // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM
852
- // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices
853
- // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7
854
- t.version('Android') > 2.1 && t.is('Webkit') || // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800
875
+ t.os('iOS') && t.version('iPad') >= 4.3 || t.os('iOS') && t.version('iPhone') >= 3.1 || t.os('iOS') && t.version('iPod') >= 3.1 || t.version('Android') > 2.1 && t.is('Webkit') || // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800
855
876
  t.version('Windows Phone OS') >= 7.0 || // Blackberry 7 - Tested on BlackBerry Torch 9810
856
877
  // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670
857
878
  t.is('BlackBerry') && t.version('BlackBerry') >= 6.0 || // Blackberry Playbook (1.0-2.0) - Tested on PlayBook
858
- t.match('Playbook.*Tablet') || // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0)
859
- t.version('webOS') >= 1.4 && t.match('Palm|Pre|Pixi') || // Palm WebOS 3.0 - Tested on HP TouchPad
860
- t.match('hp.*TouchPad') || // Firefox Mobile (12 Beta) - Tested on Android 2.3 device
861
- t.is('Firefox') && t.version('Firefox') >= 12 || // Chrome for Android - Tested on Android 4.0, 4.1 device
862
- t.is('Chrome') && t.is('AndroidOS') && t.version('Android') >= 4.0 || // Skyfire 4.1 - Tested on Android 2.3 device
863
- t.is('Skyfire') && t.version('Skyfire') >= 4.1 && t.is('AndroidOS') && t.version('Android') >= 2.3 || // Opera Mobile 11.5-12: Tested on Android 2.3
864
- t.is('Opera') && t.version('Opera Mobi') > 11 && t.is('AndroidOS') || // Meego 1.2 - Tested on Nokia 950 and N9
879
+ t.match('Playbook.*Tablet') || t.version('webOS') >= 1.4 && t.match('Palm|Pre|Pixi') || // Palm WebOS 3.0 - Tested on HP TouchPad
880
+ t.match('hp.*TouchPad') || t.is('Firefox') && t.version('Firefox') >= 12 || t.is('Chrome') && t.is('AndroidOS') && t.version('Android') >= 4.0 || t.is('Skyfire') && t.version('Skyfire') >= 4.1 && t.is('AndroidOS') && t.version('Android') >= 2.3 || t.is('Opera') && t.version('Opera Mobi') > 11 && t.is('AndroidOS') || // Meego 1.2 - Tested on Nokia 950 and N9
865
881
  t.is('MeeGoOS') || // Tizen (pre-release) - Tested on early hardware
866
882
  t.is('Tizen') || // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser
867
883
  // @todo: more tests here!
868
- t.is('Dolfin') && t.version('Bada') >= 2.0 || // UC Browser - Tested on Android 2.3 device
869
- (t.is('UC Browser') || t.is('Dolfin')) && t.version('Android') >= 2.3 || // Kindle 3 and Fire - Tested on the built-in WebKit browser for each
870
- t.match('Kindle Fire') || t.is('Kindle') && t.version('Kindle') >= 3.0 || // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet
884
+ t.is('Dolfin') && t.version('Bada') >= 2.0 || (t.is('UC Browser') || t.is('Dolfin')) && t.version('Android') >= 2.3 || t.match('Kindle Fire') || t.is('Kindle') && t.version('Kindle') >= 3.0 || // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet
871
885
  t.is('AndroidOS') && t.is('NookTablet') || // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7
872
886
  t.version('Chrome') >= 11 && !$isMobile || // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7
873
887
  t.version('Safari') >= 5.0 && !$isMobile || // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7
@@ -879,8 +893,7 @@ var mobileDetect = createCommonjsModule(function (module) {
879
893
  }
880
894
 
881
895
  if (t.os('iOS') && t.version('iPad') < 4.3 || t.os('iOS') && t.version('iPhone') < 3.1 || t.os('iOS') && t.version('iPod') < 3.1 || // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770
882
- t.is('Blackberry') && t.version('BlackBerry') >= 5 && t.version('BlackBerry') < 6 || //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3
883
- t.version('Opera Mini') >= 5.0 && t.version('Opera Mini') <= 6.5 && (t.version('Android') >= 2.3 || t.is('iOS')) || // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)
896
+ t.is('Blackberry') && t.version('BlackBerry') >= 5 && t.version('BlackBerry') < 6 || t.version('Opera Mini') >= 5.0 && t.version('Opera Mini') <= 6.5 && (t.version('Android') >= 2.3 || t.is('iOS')) || // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)
884
897
  t.match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || // @todo: report this (tested on Nokia N71)
885
898
  t.version('Opera Mobi') >= 11 && t.is('SymbianOS')) {
886
899
  return 'B';
@@ -1253,7 +1266,9 @@ var mobileDetect = createCommonjsModule(function (module) {
1253
1266
  throw new Error('unknown environment');
1254
1267
  }
1255
1268
  }());
1256
- });
1269
+ }(mobileDetect));
1270
+
1271
+ var MobileDetect = mobileDetect.exports;
1257
1272
 
1258
1273
  class MethodHandler {
1259
1274
  constructor({ name, success, fail, complete }) {
@@ -1287,10 +1302,18 @@ class CallbackManager {
1287
1302
  constructor() {
1288
1303
  this.callbacks = [];
1289
1304
  }
1305
+ /**
1306
+ * 添加回调
1307
+ * @param {{ callback: function, ctx: any } | function} opt
1308
+ */
1290
1309
  add(opt) {
1291
1310
  if (opt)
1292
1311
  this.callbacks.push(opt);
1293
1312
  }
1313
+ /**
1314
+ * 移除回调
1315
+ * @param {{ callback: function, ctx: any } | function} opt
1316
+ */
1294
1317
  remove(opt) {
1295
1318
  if (opt) {
1296
1319
  let pos = -1;
@@ -1304,9 +1327,17 @@ class CallbackManager {
1304
1327
  }
1305
1328
  }
1306
1329
  }
1330
+ /**
1331
+ * 获取回调函数数量
1332
+ * @return {number}
1333
+ */
1307
1334
  count() {
1308
1335
  return this.callbacks.length;
1309
1336
  }
1337
+ /**
1338
+ * 触发回调
1339
+ * @param {...any} args 回调的调用参数
1340
+ */
1310
1341
  trigger(...args) {
1311
1342
  this.callbacks.forEach(opt => {
1312
1343
  if (typeof opt === 'function') {
@@ -1321,7 +1352,7 @@ class CallbackManager {
1321
1352
  }
1322
1353
 
1323
1354
  const getSystemInfoSync = () => {
1324
- const md = new mobileDetect(navigator.userAgent);
1355
+ const md = new MobileDetect(navigator.userAgent);
1325
1356
  const info = {
1326
1357
  brand: md.mobile() || '',
1327
1358
  model: md.mobile() || '',
@@ -1337,6 +1368,7 @@ const getSystemInfoSync = () => {
1337
1368
  language: navigator.language,
1338
1369
  fontSizeSetting: NaN,
1339
1370
  SDKVersion: '',
1371
+ // TODO
1340
1372
  albumAuthorized: false,
1341
1373
  benchmarkLevel: 0,
1342
1374
  bluetoothEnabled: false,
@@ -1376,6 +1408,7 @@ const getSystemInfo = async (options = {}) => {
1376
1408
  };
1377
1409
 
1378
1410
  function getConnection() {
1411
+ // @ts-ignore
1379
1412
  return navigator.connection || navigator.mozConnection || navigator.webkitConnection || navigator.msConnection;
1380
1413
  }
1381
1414
  const getNetworkType = (options = {}) => {
@@ -1383,28 +1416,38 @@ const getNetworkType = (options = {}) => {
1383
1416
  const { success, fail, complete } = options;
1384
1417
  const handle = new MethodHandler({ name: 'getNetworkType', success, fail, complete });
1385
1418
  let networkType = 'unknown';
1419
+ // 浏览器不支持获取网络状态
1386
1420
  if (!connection) {
1387
1421
  return handle.success({ networkType });
1388
1422
  }
1423
+ // Supports only the navigator.connection.type value which doesn't match the latest spec.
1424
+ // https://www.davidbcalhoun.com/2010/using-navigator-connection-android/
1389
1425
  if (!isNaN(Number(connection.type))) {
1390
1426
  switch (connection.type) {
1427
+ // @ts-ignore
1391
1428
  case connection.WIFI:
1392
1429
  networkType = 'wifi';
1393
1430
  break;
1431
+ // @ts-ignore
1394
1432
  case connection.CELL_3G:
1395
1433
  networkType = '3g';
1396
1434
  break;
1435
+ // @ts-ignore
1397
1436
  case connection.CELL_2G:
1398
1437
  networkType = '2g';
1399
1438
  break;
1400
1439
  default:
1440
+ // ETHERNET, UNKNOWN
1401
1441
  networkType = 'unknown';
1402
1442
  }
1403
1443
  }
1404
1444
  else if (connection.type) {
1405
- networkType = connection.type;
1445
+ // @ts-ignore
1446
+ networkType = connection.type; // Only supports the type value.
1447
+ // @ts-ignore
1406
1448
  }
1407
1449
  else if (connection.effectiveType) {
1450
+ // @ts-ignore
1408
1451
  networkType = connection.effectiveType;
1409
1452
  }
1410
1453
  return handle.success({ networkType });
@@ -1426,12 +1469,15 @@ const onNetworkStatusChange = (cb) => {
1426
1469
  const offNetworkStatusChange = temporarilyNotSupport('offNetworkStatusChange');
1427
1470
  const getLocalIPAddress = temporarilyNotSupport('getLocalIPAddress');
1428
1471
 
1472
+ // 更新
1429
1473
  const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
1430
1474
  const getUpdateManager = temporarilyNotSupport('getUpdateManager');
1431
1475
 
1476
+ // 生命周期
1432
1477
  const getLaunchOptionsSync = temporarilyNotSupport('getLaunchOptionsSync');
1433
1478
  const getEnterOptionsSync = temporarilyNotSupport('getEnterOptionsSync');
1434
1479
 
1480
+ // 应用级事件
1435
1481
  const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection');
1436
1482
  const onThemeChange = temporarilyNotSupport('onThemeChange');
1437
1483
  const onPageNotFound = temporarilyNotSupport('onPageNotFound');
@@ -1453,11 +1499,14 @@ const setEnableDebug = temporarilyNotSupport('setEnableDebug');
1453
1499
  const getRealtimeLogManager = temporarilyNotSupport('getRealtimeLogManager');
1454
1500
  const getLogManager = temporarilyNotSupport('getLogManager');
1455
1501
 
1502
+ // 性能
1456
1503
  const reportPerformance = temporarilyNotSupport('reportPerformance');
1457
1504
  const getPerformance = temporarilyNotSupport('getPerformance');
1458
1505
 
1506
+ // 加密
1459
1507
  const getUserCryptoManager = temporarilyNotSupport('getUserCryptoManager');
1460
1508
 
1509
+ // TODO env 环境变量
1461
1510
  const canIUse = temporarilyNotSupport('canIUse');
1462
1511
  function arrayBufferToBase64(arrayBuffer) {
1463
1512
  return fromByteArray_1(arrayBuffer);
@@ -1521,6 +1570,7 @@ class CanvasContext {
1521
1570
  get shadowOffsetY() { return this.ctx.shadowOffsetY; }
1522
1571
  set strokeStyle(e) { this.enqueueActions(() => { this.ctx.strokeStyle = e; }); }
1523
1572
  get strokeStyle() { return this.ctx.strokeStyle; }
1573
+ /** 小程序文档中不包括 ↓↓↓ */
1524
1574
  set textAlign(e) { this.ctx.textAlign = e; }
1525
1575
  get textAlign() { return this.ctx.textAlign; }
1526
1576
  set textBaseline(e) { this.ctx.textBaseline = e; }
@@ -1533,6 +1583,7 @@ class CanvasContext {
1533
1583
  get imageSmoothingQuality() { return this.ctx.imageSmoothingQuality; }
1534
1584
  set filter(e) { this.enqueueActions(() => { this.ctx.filter = e; }); }
1535
1585
  get filter() { return this.ctx.filter; }
1586
+ /** 小程序文档中不包括 ↑↑↑ */
1536
1587
  arc(...args) { return this.enqueueActions(this.ctx.arc, ...args); }
1537
1588
  arcTo(...args) { return this.enqueueActions(this.ctx.arcTo, ...args); }
1538
1589
  beginPath(...args) { return this.enqueueActions(this.ctx.beginPath, ...args); }
@@ -1543,11 +1594,16 @@ class CanvasContext {
1543
1594
  createPattern(image, repetition) {
1544
1595
  return this.createPattern(image, repetition);
1545
1596
  }
1597
+ /**
1598
+ * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
1599
+ * @todo 每次 draw 都会读取 width 和 height
1600
+ */
1546
1601
  async draw(reserve, callback) {
1547
1602
  try {
1548
1603
  if (!reserve) {
1549
1604
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
1550
1605
  }
1606
+ // 部分 action 是异步的
1551
1607
  for (const { func, args } of this.actions) {
1552
1608
  await func.apply(this.ctx, args);
1553
1609
  }
@@ -1555,6 +1611,7 @@ class CanvasContext {
1555
1611
  callback && callback();
1556
1612
  }
1557
1613
  catch (e) {
1614
+ /* eslint-disable no-throw-literal */
1558
1615
  throw {
1559
1616
  errMsg: e.message
1560
1617
  };
@@ -1562,6 +1619,7 @@ class CanvasContext {
1562
1619
  }
1563
1620
  drawImage(imageResource, ...extra) {
1564
1621
  this.enqueueActions(() => {
1622
+ // 需要转换为 Image
1565
1623
  if (typeof imageResource === 'string') {
1566
1624
  const img = new Image();
1567
1625
  img.src = imageResource;
@@ -1649,6 +1707,9 @@ class CanvasContext {
1649
1707
  }
1650
1708
  }
1651
1709
 
1710
+ /**
1711
+ * 创建 canvas 的绘图上下文 CanvasContext 对象
1712
+ */
1652
1713
  const createCanvasContext = (canvasId, inst) => {
1653
1714
  const el = findDOM(inst);
1654
1715
  const canvas = el === null || el === void 0 ? void 0 : el.querySelector(`canvas[canvas-id="${canvasId}"]`);
@@ -1661,6 +1722,10 @@ const createCanvasContext = (canvasId, inst) => {
1661
1722
  return context;
1662
1723
  };
1663
1724
 
1725
+ /**
1726
+ * 把当前画布指定区域的内容导出生成指定大小的图片。在 draw() 回调里调用该方法才能保证图片导出成功。
1727
+ * @todo 暂未支持尺寸相关功能
1728
+ */
1664
1729
  const canvasToTempFilePath = ({ canvasId, fileType, quality, success, fail, complete }, inst) => {
1665
1730
  const handle = new MethodHandler({ name: 'canvasToTempFilePath', success, fail, complete });
1666
1731
  const el = findDOM(inst);
@@ -1678,12 +1743,17 @@ const canvasToTempFilePath = ({ canvasId, fileType, quality, success, fail, comp
1678
1743
  }
1679
1744
  };
1680
1745
 
1746
+ /**
1747
+ * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 <canvas> 组件
1748
+ * @todo 暂未支持尺寸相关功能
1749
+ */
1681
1750
  const canvasPutImageData = ({ canvasId, data, x, y, success, fail, complete }, inst) => {
1682
1751
  const handle = new MethodHandler({ name: 'canvasPutImageData', success, fail, complete });
1683
1752
  const el = findDOM(inst);
1684
1753
  const canvas = el === null || el === void 0 ? void 0 : el.querySelector(`canvas[canvas-id="${canvasId}"]`);
1685
1754
  try {
1686
1755
  const ctx = canvas.getContext('2d');
1756
+ // TODO Uint8ClampedArray => ImageData
1687
1757
  ctx === null || ctx === void 0 ? void 0 : ctx.putImageData(data, x, y);
1688
1758
  return handle.success();
1689
1759
  }
@@ -1694,12 +1764,16 @@ const canvasPutImageData = ({ canvasId, data, x, y, success, fail, complete }, i
1694
1764
  }
1695
1765
  };
1696
1766
 
1767
+ /**
1768
+ * 获取 canvas 区域隐含的像素数据。
1769
+ */
1697
1770
  const canvasGetImageData = ({ canvasId, success, fail, complete, x, y, width, height }, inst) => {
1698
1771
  const handle = new MethodHandler({ name: 'canvasGetImageData', success, fail, complete });
1699
1772
  const el = findDOM(inst);
1700
1773
  const canvas = el === null || el === void 0 ? void 0 : el.querySelector(`canvas[canvas-id="${canvasId}"]`);
1701
1774
  try {
1702
1775
  const ctx = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
1776
+ // TODO ImageData => Uint8ClampedArray
1703
1777
  const data = ctx === null || ctx === void 0 ? void 0 : ctx.getImageData(x, y, width, height);
1704
1778
  return handle.success({
1705
1779
  width,
@@ -1714,6 +1788,7 @@ const canvasGetImageData = ({ canvasId, success, fail, complete, x, y, width, he
1714
1788
  }
1715
1789
  };
1716
1790
 
1791
+ // 画布
1717
1792
  const createOffscreenCanvas = temporarilyNotSupport('createOffscreenCanvas');
1718
1793
  const drawCanvas = temporarilyNotSupport('drawCanvas');
1719
1794
 
@@ -1722,10 +1797,13 @@ class cloud {
1722
1797
  this.init = temporarilyNotSupport('cloud.init');
1723
1798
  this.CloudID = temporarilyNotSupport('cloud.CloudID');
1724
1799
  this.callFunction = temporarilyNotSupport('cloud.callFunction');
1800
+ // @ts-ignore
1725
1801
  this.uploadFile = temporarilyNotSupport('cloud.uploadFile');
1802
+ // @ts-ignore
1726
1803
  this.downloadFile = temporarilyNotSupport('cloud.downloadFile');
1727
1804
  this.getTempFileURL = temporarilyNotSupport('cloud.getTempFileURL');
1728
1805
  this.deleteFile = temporarilyNotSupport('cloud.deleteFile');
1806
+ // @ts-ignore
1729
1807
  this.database = temporarilyNotSupport('cloud.database');
1730
1808
  this.callContainer = temporarilyNotSupport('cloud.callContainer');
1731
1809
  }
@@ -1736,8 +1814,11 @@ const reportAnalytics = temporarilyNotSupport('reportAnalytics');
1736
1814
  const reportEvent = temporarilyNotSupport('reportEvent');
1737
1815
  const getExptInfoSync = temporarilyNotSupport('getExptInfoSync');
1738
1816
 
1739
- const callbackManager = new CallbackManager();
1817
+ const callbackManager$3 = new CallbackManager();
1740
1818
  let devicemotionListener;
1819
+ /**
1820
+ * 停止监听加速度数据。
1821
+ */
1741
1822
  const stopAccelerometer = ({ success, fail, complete } = {}) => {
1742
1823
  const res = {};
1743
1824
  const handle = new MethodHandler({ name: 'stopAccelerometer', success, fail, complete });
@@ -1750,7 +1831,7 @@ const stopAccelerometer = ({ success, fail, complete } = {}) => {
1750
1831
  return handle.fail(res);
1751
1832
  }
1752
1833
  };
1753
- const INTERVAL_MAP = {
1834
+ const INTERVAL_MAP$1 = {
1754
1835
  game: {
1755
1836
  interval: 20,
1756
1837
  frequency: 50
@@ -1772,7 +1853,7 @@ const getDevicemotionListener = interval => {
1772
1853
  return;
1773
1854
  lock = true;
1774
1855
  timer && clearTimeout(timer);
1775
- callbackManager.trigger({
1856
+ callbackManager$3.trigger({
1776
1857
  x: evt.acceleration.x || 0,
1777
1858
  y: evt.acceleration.y || 0,
1778
1859
  z: evt.acceleration.z || 0
@@ -1780,11 +1861,14 @@ const getDevicemotionListener = interval => {
1780
1861
  timer = setTimeout(() => { lock = false; }, interval);
1781
1862
  };
1782
1863
  };
1864
+ /**
1865
+ * 开始监听加速度数据。
1866
+ */
1783
1867
  const startAccelerometer = ({ interval = 'normal', success, fail, complete } = {}) => {
1784
1868
  const handle = new MethodHandler({ name: 'startAccelerometer', success, fail, complete });
1785
1869
  try {
1786
1870
  if (window.DeviceMotionEvent) {
1787
- const intervalObj = INTERVAL_MAP[interval];
1871
+ const intervalObj = INTERVAL_MAP$1[interval];
1788
1872
  if (devicemotionListener) {
1789
1873
  stopAccelerometer();
1790
1874
  }
@@ -1800,18 +1884,27 @@ const startAccelerometer = ({ interval = 'normal', success, fail, complete } = {
1800
1884
  return handle.fail({ errMsg: e.message });
1801
1885
  }
1802
1886
  };
1887
+ /**
1888
+ * 监听加速度数据事件。频率根据 Taro.startAccelerometer() 的 interval 参数。可使用 Taro.stopAccelerometer() 停止监听。
1889
+ */
1803
1890
  const onAccelerometerChange = callback => {
1804
- callbackManager.add(callback);
1891
+ callbackManager$3.add(callback);
1805
1892
  };
1893
+ /**
1894
+ * 取消监听加速度数据事件,参数为空,则取消所有的事件监听
1895
+ */
1806
1896
  const offAccelerometerChange = callback => {
1807
- callbackManager.remove(callback);
1897
+ callbackManager$3.remove(callback);
1808
1898
  };
1809
1899
 
1900
+ // 无障碍
1810
1901
  const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility');
1811
1902
 
1903
+ // 电量
1812
1904
  const getBatteryInfoSync = temporarilyNotSupport('getBatteryInfoSync');
1813
1905
  const getBatteryInfo = temporarilyNotSupport('getBatteryInfo');
1814
1906
 
1907
+ // 蓝牙-通用
1815
1908
  const stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery');
1816
1909
  const startBluetoothDevicesDiscovery = temporarilyNotSupport('startBluetoothDevicesDiscovery');
1817
1910
  const openBluetoothAdapter = temporarilyNotSupport('openBluetoothAdapter');
@@ -1826,6 +1919,7 @@ const getBluetoothDevices = temporarilyNotSupport('getBluetoothDevices');
1826
1919
  const getBluetoothAdapterState = temporarilyNotSupport('getBluetoothAdapterState');
1827
1920
  const closeBluetoothAdapter = temporarilyNotSupport('closeBluetoothAdapter');
1828
1921
 
1922
+ // 蓝牙-低功耗中心设备
1829
1923
  const writeBLECharacteristicValue = temporarilyNotSupport('writeBLECharacteristicValue');
1830
1924
  const setBLEMTU = temporarilyNotSupport('setBLEMTU');
1831
1925
  const readBLECharacteristicValue = temporarilyNotSupport('readBLECharacteristicValue');
@@ -1843,13 +1937,16 @@ const getBLEDeviceCharacteristics = temporarilyNotSupport('getBLEDeviceCharacter
1843
1937
  const createBLEConnection = temporarilyNotSupport('createBLEConnection');
1844
1938
  const closeBLEConnection = temporarilyNotSupport('closeBLEConnection');
1845
1939
 
1940
+ // 蓝牙-低功耗外围设备
1846
1941
  const onBLEPeripheralConnectionStateChanged = temporarilyNotSupport('onBLEPeripheralConnectionStateChanged');
1847
1942
  const offBLEPeripheralConnectionStateChanged = temporarilyNotSupport('offBLEPeripheralConnectionStateChanged');
1848
1943
  const createBLEPeripheralServer = temporarilyNotSupport('createBLEPeripheralServer');
1849
1944
 
1945
+ // 日历
1850
1946
  const addPhoneRepeatCalendar = temporarilyNotSupport('addPhoneRepeatCalendar');
1851
1947
  const addPhoneCalendar = temporarilyNotSupport('addPhoneCalendar');
1852
1948
 
1949
+ // 周期性更新
1853
1950
  const setBackgroundFetchToken = temporarilyNotSupport('setBackgroundFetchToken');
1854
1951
  const onBackgroundFetchData = temporarilyNotSupport('onBackgroundFetchData');
1855
1952
  const getBackgroundFetchToken = temporarilyNotSupport('getBackgroundFetchToken');
@@ -1861,6 +1958,7 @@ function getItem(key) {
1861
1958
  item = JSON.parse(localStorage.getItem(key) || '');
1862
1959
  }
1863
1960
  catch (e) { }
1961
+ // 只返回使用 Taro.setStorage API 存储的数据
1864
1962
  if (item && typeof item === 'object' && item.hasOwnProperty('data')) {
1865
1963
  return { result: true, data: item.data };
1866
1964
  }
@@ -1868,6 +1966,7 @@ function getItem(key) {
1868
1966
  return { result: false };
1869
1967
  }
1870
1968
  }
1969
+ // 数据缓存
1871
1970
  const setStorageSync = (key, data = '') => {
1872
1971
  if (typeof key !== 'string') {
1873
1972
  console.error(getParameterError({
@@ -1888,6 +1987,7 @@ const setStorageSync = (key, data = '') => {
1888
1987
  localStorage.setItem(key, JSON.stringify(obj));
1889
1988
  };
1890
1989
  const setStorage = (options) => {
1990
+ // options must be an Object
1891
1991
  const isObject = shouldBeObject(options);
1892
1992
  if (!isObject.flag) {
1893
1993
  const res = { errMsg: `setStorage:fail ${isObject.msg}` };
@@ -1921,6 +2021,7 @@ const removeStorageSync = (key) => {
1921
2021
  localStorage.removeItem(key);
1922
2022
  };
1923
2023
  const removeStorage = (options) => {
2024
+ // options must be an Object
1924
2025
  const isObject = shouldBeObject(options);
1925
2026
  if (!isObject.flag) {
1926
2027
  const res = { errMsg: `removeStorage:fail ${isObject.msg}` };
@@ -1968,6 +2069,7 @@ const getStorageInfo = ({ success, fail, complete } = {}) => {
1968
2069
  return handle.success(getStorageInfoSync());
1969
2070
  };
1970
2071
  const getStorage = (options) => {
2072
+ // options must be an Object
1971
2073
  const isObject = shouldBeObject(options);
1972
2074
  if (!isObject.flag) {
1973
2075
  const res = { errMsg: `getStorage:fail ${isObject.msg}` };
@@ -2005,6 +2107,12 @@ const clearStorage = ({ success, fail, complete } = {}) => {
2005
2107
  return handle.success();
2006
2108
  };
2007
2109
 
2110
+ /**
2111
+ * 剪贴板部分的api参考了Chameleon项目的实现:
2112
+ *
2113
+ * setClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/setClipBoardData
2114
+ * getClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/getClipBoardData
2115
+ */
2008
2116
  const CLIPBOARD_STORAGE_NAME = 'taro_clipboard';
2009
2117
  document.addEventListener('copy', () => {
2010
2118
  var _a;
@@ -2015,10 +2123,18 @@ document.addEventListener('copy', () => {
2015
2123
  console.error(e);
2016
2124
  });
2017
2125
  });
2126
+ /**
2127
+ * 设置系统剪贴板的内容
2128
+ */
2018
2129
  const setClipboardData = async ({ data, success, fail, complete }) => {
2019
2130
  const handle = new MethodHandler({ name: 'setClipboardData', success, fail, complete });
2020
2131
  try {
2021
2132
  setStorageSync(CLIPBOARD_STORAGE_NAME, data);
2133
+ /**
2134
+ * 已于 iPhone 6s Plus iOS 13.1.3 上的 Safari 测试通过
2135
+ * iOS < 10 的系统可能无法使用编程方式访问剪贴板,参考:
2136
+ * https://stackoverflow.com/questions/34045777/copy-to-clipboard-using-javascript-in-ios/34046084
2137
+ */
2022
2138
  if (typeof document.execCommand === 'function') {
2023
2139
  const textarea = document.createElement('textarea');
2024
2140
  textarea.readOnly = true;
@@ -2041,6 +2157,9 @@ const setClipboardData = async ({ data, success, fail, complete }) => {
2041
2157
  return handle.fail({ errMsg: e.message });
2042
2158
  }
2043
2159
  };
2160
+ /**
2161
+ * 获取系统剪贴板的内容
2162
+ */
2044
2163
  const getClipboardData = async ({ success, fail, complete } = {}) => {
2045
2164
  const handle = new MethodHandler({ name: 'getClipboardData', success, fail, complete });
2046
2165
  try {
@@ -2052,8 +2171,11 @@ const getClipboardData = async ({ success, fail, complete } = {}) => {
2052
2171
  }
2053
2172
  };
2054
2173
 
2055
- const callbackManager$1 = new CallbackManager();
2174
+ const callbackManager$2 = new CallbackManager();
2056
2175
  let compassListener;
2176
+ /**
2177
+ * 停止监听罗盘数据
2178
+ */
2057
2179
  const stopCompass = ({ success, fail, complete } = {}) => {
2058
2180
  const handle = new MethodHandler({ name: 'stopCompass', success, fail, complete });
2059
2181
  try {
@@ -2064,7 +2186,7 @@ const stopCompass = ({ success, fail, complete } = {}) => {
2064
2186
  return handle.fail({ errMsg: e.message });
2065
2187
  }
2066
2188
  };
2067
- const getDeviceOrientationListener = interval => {
2189
+ const getDeviceOrientationListener$1 = interval => {
2068
2190
  let lock;
2069
2191
  let timer;
2070
2192
  return evt => {
@@ -2072,12 +2194,15 @@ const getDeviceOrientationListener = interval => {
2072
2194
  return;
2073
2195
  lock = true;
2074
2196
  timer && clearTimeout(timer);
2075
- callbackManager$1.trigger({
2197
+ callbackManager$2.trigger({
2076
2198
  direction: 360 - evt.alpha
2077
2199
  });
2078
2200
  timer = setTimeout(() => { lock = false; }, interval);
2079
2201
  };
2080
2202
  };
2203
+ /**
2204
+ * 开始监听罗盘数据
2205
+ */
2081
2206
  const startCompass = ({ success, fail, complete } = {}) => {
2082
2207
  const handle = new MethodHandler({ name: 'startCompass', success, fail, complete });
2083
2208
  try {
@@ -2085,7 +2210,7 @@ const startCompass = ({ success, fail, complete } = {}) => {
2085
2210
  if (compassListener) {
2086
2211
  stopCompass();
2087
2212
  }
2088
- compassListener = getDeviceOrientationListener(200);
2213
+ compassListener = getDeviceOrientationListener$1(200);
2089
2214
  window.addEventListener('deviceorientation', compassListener, true);
2090
2215
  }
2091
2216
  else {
@@ -2097,23 +2222,33 @@ const startCompass = ({ success, fail, complete } = {}) => {
2097
2222
  return handle.fail({ errMsg: e.message });
2098
2223
  }
2099
2224
  };
2225
+ /**
2226
+ * 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
2227
+ */
2100
2228
  const onCompassChange = callback => {
2101
- callbackManager$1.add(callback);
2229
+ callbackManager$2.add(callback);
2102
2230
  };
2231
+ /**
2232
+ * 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
2233
+ */
2103
2234
  const offCompassChange = callback => {
2104
- callbackManager$1.remove(callback);
2235
+ callbackManager$2.remove(callback);
2105
2236
  };
2106
2237
 
2238
+ // 联系人
2107
2239
  const chooseContact = temporarilyNotSupport('chooseContact');
2108
2240
  const addPhoneContact = temporarilyNotSupport('addPhoneContact');
2109
2241
 
2242
+ // 加密
2110
2243
  const getRandomValues = temporarilyNotSupport('getRandomValues');
2111
2244
 
2245
+ // 陀螺仪
2112
2246
  const stopGyroscope = temporarilyNotSupport('stopGyroscope');
2113
2247
  const startGyroscope = temporarilyNotSupport('startGyroscope');
2114
2248
  const onGyroscopeChange = temporarilyNotSupport('onGyroscopeChange');
2115
2249
  const offGyroscopeChange = temporarilyNotSupport('offGyroscopeChange');
2116
2250
 
2251
+ // 蓝牙-信标(Beacon)
2117
2252
  const stopBeaconDiscovery = temporarilyNotSupport('stopBeaconDiscovery');
2118
2253
  const startBeaconDiscovery = temporarilyNotSupport('startBeaconDiscovery');
2119
2254
  const onBeaconUpdate = temporarilyNotSupport('onBeaconUpdate');
@@ -2122,17 +2257,19 @@ const offBeaconUpdate = temporarilyNotSupport('offBeaconUpdate');
2122
2257
  const offBeaconServiceChange = temporarilyNotSupport('offBeaconServiceChange');
2123
2258
  const getBeacons = temporarilyNotSupport('getBeacons');
2124
2259
 
2260
+ // 键盘
2125
2261
  const onKeyboardHeightChange = temporarilyNotSupport('onKeyboardHeightChange');
2126
2262
  const offKeyboardHeightChange = temporarilyNotSupport('offKeyboardHeightChange');
2127
2263
  const hideKeyboard = temporarilyNotSupport('hideKeyboard');
2128
2264
  const getSelectedTextRange = temporarilyNotSupport('getSelectedTextRange');
2129
2265
 
2266
+ // 内存
2130
2267
  const onMemoryWarning = temporarilyNotSupport('onMemoryWarning');
2131
2268
  const offMemoryWarning = temporarilyNotSupport('offMemoryWarning');
2132
2269
 
2133
- const callbackManager$2 = new CallbackManager();
2270
+ const callbackManager$1 = new CallbackManager();
2134
2271
  let deviceMotionListener;
2135
- const INTERVAL_MAP$1 = {
2272
+ const INTERVAL_MAP = {
2136
2273
  game: {
2137
2274
  interval: 20,
2138
2275
  frequency: 50
@@ -2146,6 +2283,9 @@ const INTERVAL_MAP$1 = {
2146
2283
  frequency: 5
2147
2284
  }
2148
2285
  };
2286
+ /**
2287
+ * 停止监听设备方向的变化。
2288
+ */
2149
2289
  const stopDeviceMotionListening = ({ success, fail, complete } = {}) => {
2150
2290
  const handle = new MethodHandler({ name: 'stopDeviceMotionListening', success, fail, complete });
2151
2291
  try {
@@ -2156,7 +2296,7 @@ const stopDeviceMotionListening = ({ success, fail, complete } = {}) => {
2156
2296
  return handle.fail({ errMsg: e.message });
2157
2297
  }
2158
2298
  };
2159
- const getDeviceOrientationListener$1 = interval => {
2299
+ const getDeviceOrientationListener = interval => {
2160
2300
  let lock;
2161
2301
  let timer;
2162
2302
  return evt => {
@@ -2164,7 +2304,7 @@ const getDeviceOrientationListener$1 = interval => {
2164
2304
  return;
2165
2305
  lock = true;
2166
2306
  timer && clearTimeout(timer);
2167
- callbackManager$2.trigger({
2307
+ callbackManager$1.trigger({
2168
2308
  alpha: evt.alpha,
2169
2309
  beta: evt.beta,
2170
2310
  gamma: evt.gamma
@@ -2172,15 +2312,18 @@ const getDeviceOrientationListener$1 = interval => {
2172
2312
  timer = setTimeout(() => { lock = false; }, interval);
2173
2313
  };
2174
2314
  };
2315
+ /**
2316
+ * 开始监听设备方向的变化。
2317
+ */
2175
2318
  const startDeviceMotionListening = ({ interval = 'normal', success, fail, complete } = {}) => {
2176
2319
  const handle = new MethodHandler({ name: 'startDeviceMotionListening', success, fail, complete });
2177
2320
  try {
2178
- const intervalObj = INTERVAL_MAP$1[interval];
2321
+ const intervalObj = INTERVAL_MAP[interval];
2179
2322
  if (window.DeviceOrientationEvent) {
2180
2323
  if (deviceMotionListener) {
2181
2324
  stopDeviceMotionListening();
2182
2325
  }
2183
- deviceMotionListener = getDeviceOrientationListener$1(intervalObj.interval);
2326
+ deviceMotionListener = getDeviceOrientationListener(intervalObj.interval);
2184
2327
  window.addEventListener('deviceorientation', deviceMotionListener, true);
2185
2328
  }
2186
2329
  else {
@@ -2192,13 +2335,20 @@ const startDeviceMotionListening = ({ interval = 'normal', success, fail, comple
2192
2335
  return handle.fail({ errMsg: e.message });
2193
2336
  }
2194
2337
  };
2338
+ /**
2339
+ * 监听设备方向变化事件。
2340
+ */
2195
2341
  const onDeviceMotionChange = callback => {
2196
- callbackManager$2.add(callback);
2342
+ callbackManager$1.add(callback);
2197
2343
  };
2344
+ /**
2345
+ * 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
2346
+ */
2198
2347
  const offDeviceMotionChange = callback => {
2199
- callbackManager$2.remove(callback);
2348
+ callbackManager$1.remove(callback);
2200
2349
  };
2201
2350
 
2351
+ // NFC
2202
2352
  const stopHCE = temporarilyNotSupport('stopHCE');
2203
2353
  const startHCE = temporarilyNotSupport('startHCE');
2204
2354
  const sendHCEMessage = temporarilyNotSupport('sendHCEMessage');
@@ -2208,6 +2358,7 @@ const getNFCAdapter = temporarilyNotSupport('getNFCAdapter');
2208
2358
  const getHCEState = temporarilyNotSupport('getHCEState');
2209
2359
 
2210
2360
  const makePhoneCall = (options) => {
2361
+ // options must be an Object
2211
2362
  const isObject = shouldBeObject(options);
2212
2363
  if (!isObject.flag) {
2213
2364
  const res = { errMsg: `makePhoneCall:fail ${isObject.msg}` };
@@ -2229,11 +2380,13 @@ const makePhoneCall = (options) => {
2229
2380
  return handle.success();
2230
2381
  };
2231
2382
 
2383
+ // 扫码
2232
2384
  const scanCode = processOpenApi('scanQRCode', { needResult: 1 }, res => ({
2233
2385
  errMsg: res.errMsg === 'scanQRCode:ok' ? 'scanCode:ok' : res.errMsg,
2234
2386
  result: res.resultStr
2235
2387
  }));
2236
2388
 
2389
+ // 屏幕
2237
2390
  const setVisualEffectOnCapture = temporarilyNotSupport('setVisualEffectOnCapture');
2238
2391
  const setScreenBrightness = temporarilyNotSupport('setScreenBrightness');
2239
2392
  const setKeepScreenOn = temporarilyNotSupport('setKeepScreenOn');
@@ -2249,6 +2402,9 @@ const vibrator = function vibrator(mm) {
2249
2402
  console.warn('当前浏览器不支持vibrate');
2250
2403
  }
2251
2404
  };
2405
+ /**
2406
+ * 使手机发生较短时间的振动(15 ms)。仅在 iPhone 7 / 7 Plus 以上及 Android 机型生效
2407
+ */
2252
2408
  const vibrateShort = ({ success, fail, complete } = {}) => {
2253
2409
  const handle = new MethodHandler({ name: 'vibrateShort', success, fail, complete });
2254
2410
  if (vibrator) {
@@ -2259,6 +2415,9 @@ const vibrateShort = ({ success, fail, complete } = {}) => {
2259
2415
  return handle.fail();
2260
2416
  }
2261
2417
  };
2418
+ /**
2419
+ * 使手机发生较长时间的振动(400 ms)
2420
+ */
2262
2421
  const vibrateLong = ({ success, fail, complete } = {}) => {
2263
2422
  const handle = new MethodHandler({ name: 'vibrateLong', success, fail, complete });
2264
2423
  if (vibrator) {
@@ -2270,6 +2429,7 @@ const vibrateLong = ({ success, fail, complete } = {}) => {
2270
2429
  }
2271
2430
  };
2272
2431
 
2432
+ // Wi-Fi
2273
2433
  const stopWifi = temporarilyNotSupport('stopWifi');
2274
2434
  const startWifi = temporarilyNotSupport('startWifi');
2275
2435
  const setWifiList = temporarilyNotSupport('setWifiList');
@@ -2281,9 +2441,11 @@ const getWifiList = temporarilyNotSupport('getWifiList');
2281
2441
  const getConnectedWifi = temporarilyNotSupport('getConnectedWifi');
2282
2442
  const connectWifi = temporarilyNotSupport('connectWifi');
2283
2443
 
2444
+ // 第三方平台
2284
2445
  const getExtConfigSync = temporarilyNotSupport('getExtConfigSync');
2285
2446
  const getExtConfig = temporarilyNotSupport('getExtConfig');
2286
2447
 
2448
+ // 文件
2287
2449
  const saveFileToDisk = temporarilyNotSupport('saveFileToDisk');
2288
2450
  const saveFile = temporarilyNotSupport('saveFile');
2289
2451
  const removeSavedFile = temporarilyNotSupport('removeSavedFile');
@@ -2294,9 +2456,10 @@ const getFileSystemManager = temporarilyNotSupport('getFileSystemManager');
2294
2456
  const getFileInfo = temporarilyNotSupport('getFileInfo');
2295
2457
 
2296
2458
  const getApp = function () {
2297
- return Taro.getCurrentInstance().app;
2459
+ return Taro__default['default'].getCurrentInstance().app;
2298
2460
  };
2299
- const getCurrentInstance = Taro.getCurrentInstance;
2461
+ // 自定义组件
2462
+ const getCurrentInstance = Taro__default['default'].getCurrentInstance;
2300
2463
 
2301
2464
  function styleInject(css, ref) {
2302
2465
  if (ref === void 0) ref = {};
@@ -2328,7 +2491,7 @@ function styleInject(css, ref) {
2328
2491
  }
2329
2492
 
2330
2493
  var css_248z = ".taro_choose_location {\r\n position: fixed;\r\n display: flex;\r\n flex-direction: column;\r\n width: 100%;\r\n height: 100%;\r\n top: 100%;\r\n background-color: #fff;\r\n transition: ease top .3s;\r\n z-index: 1;\r\n}\r\n\r\n.taro_choose_location_bar {\r\n display: flex;\r\n flex: 0 95px;\r\n height: 95px;\r\n background-color: #ededed;\r\n color: #090909;\r\n}\r\n\r\n.taro_choose_location_back {\r\n flex: 0 45px;\r\n position: relative;\r\n width: 33px;\r\n height: 30px;\r\n margin-top: 30px;\r\n}\r\n\r\n.taro_choose_location_back::before {\r\n content: '';\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #090909;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_back::after {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n top: 0;\r\n left: 3px;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #ededed;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_title {\r\n flex: 1;\r\n line-height: 95px;\r\n padding-left: 30px;\r\n}\r\n\r\n.taro_choose_location_submit {\r\n width: 110px;\r\n height: 60px;\r\n color: #fff;\r\n background-color: #08bf62;\r\n border: none;\r\n font-size: 28px;\r\n line-height: 60px;\r\n padding: 0;\r\n margin: 18px 30px 0 0;\r\n}\r\n\r\n.taro_choose_location_frame {\r\n flex: 1;\r\n}";
2331
- const stylesheet=".taro_choose_location {\r\n position: fixed;\r\n display: flex;\r\n flex-direction: column;\r\n width: 100%;\r\n height: 100%;\r\n top: 100%;\r\n background-color: #fff;\r\n transition: ease top .3s;\r\n z-index: 1;\r\n}\r\n\r\n.taro_choose_location_bar {\r\n display: flex;\r\n flex: 0 95px;\r\n height: 95px;\r\n background-color: #ededed;\r\n color: #090909;\r\n}\r\n\r\n.taro_choose_location_back {\r\n flex: 0 45px;\r\n position: relative;\r\n width: 33px;\r\n height: 30px;\r\n margin-top: 30px;\r\n}\r\n\r\n.taro_choose_location_back::before {\r\n content: '';\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #090909;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_back::after {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n top: 0;\r\n left: 3px;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #ededed;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_title {\r\n flex: 1;\r\n line-height: 95px;\r\n padding-left: 30px;\r\n}\r\n\r\n.taro_choose_location_submit {\r\n width: 110px;\r\n height: 60px;\r\n color: #fff;\r\n background-color: #08bf62;\r\n border: none;\r\n font-size: 28px;\r\n line-height: 60px;\r\n padding: 0;\r\n margin: 18px 30px 0 0;\r\n}\r\n\r\n.taro_choose_location_frame {\r\n flex: 1;\r\n}";
2494
+ var stylesheet=".taro_choose_location {\r\n position: fixed;\r\n display: flex;\r\n flex-direction: column;\r\n width: 100%;\r\n height: 100%;\r\n top: 100%;\r\n background-color: #fff;\r\n transition: ease top .3s;\r\n z-index: 1;\r\n}\r\n\r\n.taro_choose_location_bar {\r\n display: flex;\r\n flex: 0 95px;\r\n height: 95px;\r\n background-color: #ededed;\r\n color: #090909;\r\n}\r\n\r\n.taro_choose_location_back {\r\n flex: 0 45px;\r\n position: relative;\r\n width: 33px;\r\n height: 30px;\r\n margin-top: 30px;\r\n}\r\n\r\n.taro_choose_location_back::before {\r\n content: '';\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #090909;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_back::after {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n width: 0;\r\n height: 0;\r\n top: 0;\r\n left: 3px;\r\n border: solid 15px;\r\n border-top-color: transparent;\r\n border-right-color: #ededed;\r\n border-bottom-color: transparent;\r\n border-left-color: transparent;\r\n}\r\n\r\n.taro_choose_location_title {\r\n flex: 1;\r\n line-height: 95px;\r\n padding-left: 30px;\r\n}\r\n\r\n.taro_choose_location_submit {\r\n width: 110px;\r\n height: 60px;\r\n color: #fff;\r\n background-color: #08bf62;\r\n border: none;\r\n font-size: 28px;\r\n line-height: 60px;\r\n padding: 0;\r\n margin: 18px 30px 0 0;\r\n}\r\n\r\n.taro_choose_location_frame {\r\n flex: 1;\r\n}";
2332
2495
  styleInject(css_248z,{"insertAt":"top"});
2333
2496
 
2334
2497
  function createLocationChooser(handler, key = LOCATION_APIKEY) {
@@ -2375,6 +2538,9 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
2375
2538
  container
2376
2539
  };
2377
2540
  }
2541
+ /**
2542
+ * 打开地图选择位置。
2543
+ */
2378
2544
  const chooseLocation = ({ success, fail, complete } = {}) => {
2379
2545
  const key = LOCATION_APIKEY;
2380
2546
  const handle = new MethodHandler({ name: 'chooseLocation', success, fail, complete });
@@ -2387,7 +2553,9 @@ const chooseLocation = ({ success, fail, complete } = {}) => {
2387
2553
  }, reject);
2388
2554
  }
2389
2555
  const onMessage = event => {
2556
+ // 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
2390
2557
  const loc = event.data;
2558
+ // 防止其他应用也会向该页面 post 信息,需判断 module 是否为'locationPicker'
2391
2559
  if (!loc || loc.module !== 'locationPicker')
2392
2560
  return;
2393
2561
  chooseLocation.name = loc.poiname;
@@ -2418,6 +2586,7 @@ const chooseLocation = ({ success, fail, complete } = {}) => {
2418
2586
  });
2419
2587
  };
2420
2588
 
2589
+ // 位置
2421
2590
  const stopLocationUpdate = temporarilyNotSupport('stopLocationUpdate');
2422
2591
  const startLocationUpdateBackground = temporarilyNotSupport('startLocationUpdateBackground');
2423
2592
  const startLocationUpdate = temporarilyNotSupport('startLocationUpdate');
@@ -2429,6 +2598,7 @@ const offLocationChange = temporarilyNotSupport('offLocationChange');
2429
2598
  const getLocation = processOpenApi('getLocation');
2430
2599
  const choosePoi = temporarilyNotSupport('choosePoi');
2431
2600
 
2601
+ // 音频
2432
2602
  class InnerAudioContext {
2433
2603
  constructor() {
2434
2604
  this.play = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.play(); };
@@ -2443,6 +2613,9 @@ class InnerAudioContext {
2443
2613
  this.Instance.currentTime = position;
2444
2614
  }
2445
2615
  };
2616
+ /**
2617
+ * @TODO destroy得并不干净
2618
+ */
2446
2619
  this.destroy = () => {
2447
2620
  this.stop();
2448
2621
  if (this.Instance) {
@@ -2473,7 +2646,7 @@ class InnerAudioContext {
2473
2646
  this.Instance = new Audio();
2474
2647
  this.errorStack = new CallbackManager();
2475
2648
  this.stopStack = new CallbackManager();
2476
- Taro.eventCenter.on('__taroRouterChange', () => { this.stop(); });
2649
+ Taro__default['default'].eventCenter.on('__taroRouterChange', () => { this.stop(); });
2477
2650
  }
2478
2651
  set autoplay(e) { this.setProperty('autoplay', e); }
2479
2652
  get autoplay() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.autoplay) || false; }
@@ -2505,9 +2678,13 @@ const pauseVoice = temporarilyNotSupport('pauseVoice');
2505
2678
  const getAvailableAudioSources = temporarilyNotSupport('getAvailableAudioSources');
2506
2679
  const createWebAudioContext = temporarilyNotSupport('createWebAudioContext');
2507
2680
  const createMediaAudioPlayer = temporarilyNotSupport('createMediaAudioPlayer');
2681
+ /**
2682
+ * 创建内部 audio 上下文 InnerAudioContext 对象。
2683
+ */
2508
2684
  const createInnerAudioContext = () => new InnerAudioContext();
2509
2685
  const createAudioContext = temporarilyNotSupport('createAudioContext');
2510
2686
 
2687
+ // 背景音频
2511
2688
  const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio');
2512
2689
  const seekBackgroundAudio = temporarilyNotSupport('seekBackgroundAudio');
2513
2690
  const playBackgroundAudio = temporarilyNotSupport('playBackgroundAudio');
@@ -2518,8 +2695,10 @@ const onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause');
2518
2695
  const getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState');
2519
2696
  const getBackgroundAudioManager = temporarilyNotSupport('getBackgroundAudioManager');
2520
2697
 
2698
+ // 相机
2521
2699
  const createCameraContext = temporarilyNotSupport('createCameraContext');
2522
2700
 
2701
+ // 富文本
2523
2702
  class EditorContext {
2524
2703
  constructor() {
2525
2704
  this.blur = temporarilyNotSupport('EditorContext.blur');
@@ -2537,6 +2716,12 @@ class EditorContext {
2537
2716
  }
2538
2717
  }
2539
2718
 
2719
+ /**
2720
+ * previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢!
2721
+ */
2722
+ /**
2723
+ * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
2724
+ */
2540
2725
  const previewImage = async (options) => {
2541
2726
  function loadImage(url, loadFail) {
2542
2727
  return new Promise((resolve) => {
@@ -2549,6 +2734,7 @@ const previewImage = async (options) => {
2549
2734
  div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;';
2550
2735
  div.appendChild(image);
2551
2736
  item.appendChild(div);
2737
+ // Note: 等待图片加载完后返回,会导致轮播被卡住
2552
2738
  resolve(item);
2553
2739
  if (typeof loadFail === 'function') {
2554
2740
  image.addEventListener('error', (err) => {
@@ -2557,6 +2743,7 @@ const previewImage = async (options) => {
2557
2743
  }
2558
2744
  });
2559
2745
  }
2746
+ // options must be an Object
2560
2747
  const isObject = shouldBeObject(options);
2561
2748
  if (!isObject.flag) {
2562
2749
  const res = { errMsg: `previewImage:fail ${isObject.msg}` };
@@ -2572,6 +2759,7 @@ const previewImage = async (options) => {
2572
2759
  container.remove();
2573
2760
  });
2574
2761
  const swiper = document.createElement('taro-swiper-core');
2762
+ // @ts-ignore
2575
2763
  swiper.full = true;
2576
2764
  let children = [];
2577
2765
  try {
@@ -2587,13 +2775,18 @@ const previewImage = async (options) => {
2587
2775
  swiper.appendChild(child);
2588
2776
  }
2589
2777
  const currentIndex = urls.indexOf(current);
2778
+ // @ts-ignore
2590
2779
  swiper.current = currentIndex;
2591
2780
  container.appendChild(swiper);
2592
2781
  document.body.appendChild(container);
2593
2782
  return handle.success();
2594
2783
  };
2595
2784
 
2785
+ /**
2786
+ * 获取图片信息。网络图片需先配置download域名才能生效。
2787
+ */
2596
2788
  const getImageInfo = (options) => {
2789
+ // options must be an Object
2597
2790
  const isObject = shouldBeObject(options);
2598
2791
  if (!isObject.flag) {
2599
2792
  const res = { errMsg: `getImageInfo:fail ${isObject.msg}` };
@@ -2619,7 +2812,11 @@ const getImageInfo = (options) => {
2619
2812
  });
2620
2813
  };
2621
2814
 
2815
+ /**
2816
+ * 从本地相册选择图片或使用相机拍照。
2817
+ */
2622
2818
  const chooseImage = function (options) {
2819
+ // options must be an Object
2623
2820
  const isObject = shouldBeObject(options);
2624
2821
  if (!isObject.flag) {
2625
2822
  const res = { errMsg: `chooseImage:fail ${isObject.msg}` };
@@ -2688,31 +2885,45 @@ const chooseImage = function (options) {
2688
2885
  });
2689
2886
  };
2690
2887
 
2888
+ // 图片
2691
2889
  const saveImageToPhotosAlbum = temporarilyNotSupport('saveImageToPhotosAlbum');
2692
2890
  const previewMedia = temporarilyNotSupport('previewMedia');
2693
2891
  const compressImage = temporarilyNotSupport('compressImage');
2694
2892
  const chooseMessageFile = temporarilyNotSupport('chooseMessageFile');
2695
2893
 
2894
+ // 实时音视频
2696
2895
  const createLivePusherContext = temporarilyNotSupport('createLivePusherContext');
2697
2896
  const createLivePlayerContext = temporarilyNotSupport('createLivePlayerContext');
2698
2897
 
2898
+ // 地图
2699
2899
  const createMapContext = temporarilyNotSupport('createMapContext');
2700
2900
 
2901
+ // 画面录制器
2701
2902
  const createMediaRecorder = temporarilyNotSupport('createMediaRecorder');
2702
2903
 
2904
+ // 录音
2703
2905
  const stopRecord = temporarilyNotSupport('stopRecord');
2704
2906
  const startRecord = temporarilyNotSupport('startRecord');
2705
2907
  const getRecorderManager = temporarilyNotSupport('getRecorderManager');
2706
2908
 
2909
+ // 视频
2707
2910
  const saveVideoToPhotosAlbum = temporarilyNotSupport('saveVideoToPhotosAlbum');
2708
2911
  const openVideoEditor = temporarilyNotSupport('openVideoEditor');
2709
2912
  const getVideoInfo = temporarilyNotSupport('getVideoInfo');
2913
+ /**
2914
+ * 创建 video 上下文 VideoContext 对象。
2915
+ */
2710
2916
  const createVideoContext = (id, inst) => {
2711
2917
  const el = findDOM(inst);
2918
+ // TODO HTMLVideoElement to VideoContext
2712
2919
  return el === null || el === void 0 ? void 0 : el.querySelector(`taro-video-core[id=${id}]`);
2713
2920
  };
2714
2921
  const compressVideo = temporarilyNotSupport('compressVideo');
2922
+ /**
2923
+ * 拍摄视频或从手机相册中选视频。
2924
+ */
2715
2925
  const chooseVideo = (options) => {
2926
+ // options must be an Object
2716
2927
  const isObject = shouldBeObject(options);
2717
2928
  if (!isObject.flag) {
2718
2929
  const res = { errMsg: `chooseVideo:fail ${isObject.msg}` };
@@ -2768,10 +2979,13 @@ const chooseVideo = (options) => {
2768
2979
  };
2769
2980
  const chooseMedia = temporarilyNotSupport('chooseMedia');
2770
2981
 
2982
+ // 视频解码器
2771
2983
  const createVideoDecoder = temporarilyNotSupport('createVideoDecoder');
2772
2984
 
2985
+ // 音视频合成
2773
2986
  const createMediaContainer = temporarilyNotSupport('createMediaContainer');
2774
2987
 
2988
+ // 实时语音
2775
2989
  const updateVoIPChatMuteConfig = temporarilyNotSupport('updateVoIPChatMuteConfig');
2776
2990
  const subscribeVoIPVideoMembers = temporarilyNotSupport('subscribeVoIPVideoMembers');
2777
2991
  const setEnable1v1Chat = temporarilyNotSupport('setEnable1v1Chat');
@@ -2787,25 +3001,60 @@ const offVoIPChatInterrupted = temporarilyNotSupport('offVoIPChatInterrupted');
2787
3001
  const joinVoIPChat = temporarilyNotSupport('joinVoIPChat');
2788
3002
  const exitVoIPChat = temporarilyNotSupport('exitVoIPChat');
2789
3003
 
3004
+ // 跳转
2790
3005
  const openEmbeddedMiniProgram = temporarilyNotSupport('openEmbeddedMiniProgram');
2791
3006
  const navigateToMiniProgram = temporarilyNotSupport('navigateToMiniProgram');
2792
3007
  const navigateBackMiniProgram = temporarilyNotSupport('navigateBackMiniProgram');
2793
3008
  const exitMiniProgram = temporarilyNotSupport('exitMiniProgram');
2794
3009
 
3010
+ /**
3011
+ * HTTP Response Header 事件回调函数的参数
3012
+ * @typedef {Object} HeadersReceivedParam
3013
+ * @property {Object} header 开发者服务器返回的 HTTP Response Header
3014
+ */
3015
+ /**
3016
+ * HTTP Response Header 事件的回调函数
3017
+ * @callback HeadersReceivedCallback
3018
+ * @param {HeadersReceivedParam} res 参数
3019
+ */
3020
+ /**
3021
+ * 进度变化回调函数的参数
3022
+ * @typedef {Object} ProgressUpdateParam
3023
+ * @property {number} progress 进度百分比
3024
+ * @property {number} [totalBytesWritten] 已经下载的数据长度,单位 Bytes
3025
+ * @property {number} [totalBytesSent] 已经上传的数据长度,单位 Bytes
3026
+ * @property {number} [totalBytesExpectedToWrite] 预期需要下载的数据总长度,单位 Bytes
3027
+ * @property {number} [totalBytesExpectedToSend] 预期需要上传的数据总长度,单位 Bytes
3028
+ */
3029
+ /**
3030
+ * 进度变化事件的回调函数
3031
+ * @callback ProgressUpdateCallback
3032
+ * @param {ProgressUpdateParam} res 参数
3033
+ */
2795
3034
  const NETWORK_TIMEOUT = 60000;
2796
3035
  const XHR_STATS = {
2797
3036
  UNSENT: 0,
2798
3037
  OPENED: 1,
2799
3038
  HEADERS_RECEIVED: 2,
2800
3039
  LOADING: 3,
2801
- DONE: 4
3040
+ DONE: 4 // The operation is complete.
2802
3041
  };
3042
+ /**
3043
+ * 设置xhr的header
3044
+ * @param {XMLHttpRequest} xhr
3045
+ * @param {Object} header
3046
+ */
2803
3047
  const setHeader = (xhr, header) => {
2804
3048
  let headerKey;
2805
3049
  for (headerKey in header) {
2806
3050
  xhr.setRequestHeader(headerKey, header[headerKey]);
2807
3051
  }
2808
3052
  };
3053
+ /**
3054
+ * 将 blob url 转化为文件
3055
+ * @param {string} url 要转换的 blob url
3056
+ * @returns {Promise<File>}
3057
+ */
2809
3058
  const convertObjectUrlToBlob = url => {
2810
3059
  return new Promise((resolve, reject) => {
2811
3060
  const xhr = new XMLHttpRequest();
@@ -2816,6 +3065,7 @@ const convertObjectUrlToBlob = url => {
2816
3065
  resolve(this.response);
2817
3066
  }
2818
3067
  else {
3068
+ /* eslint-disable prefer-promise-reject-errors */
2819
3069
  reject({ status: this.status });
2820
3070
  }
2821
3071
  };
@@ -2869,6 +3119,9 @@ const createDownloadTask = ({ url, header, success, error }) => {
2869
3119
  errMsg: `${apiName}:fail ${e.message}`
2870
3120
  });
2871
3121
  };
3122
+ /**
3123
+ * 中断任务
3124
+ */
2872
3125
  const abort = () => {
2873
3126
  xhr.abort();
2874
3127
  };
@@ -2887,9 +3140,25 @@ const createDownloadTask = ({ url, header, success, error }) => {
2887
3140
  }, NETWORK_TIMEOUT);
2888
3141
  };
2889
3142
  send();
3143
+ /**
3144
+ * 监听 HTTP Response Header 事件。会比请求完成事件更早
3145
+ * @param {HeadersReceivedCallback} callback HTTP Response Header 事件的回调函数
3146
+ */
2890
3147
  const onHeadersReceived = callbackManager.headersReceived.add;
3148
+ /**
3149
+ * 取消监听 HTTP Response Header 事件
3150
+ * @param {HeadersReceivedCallback} callback HTTP Response Header 事件的回调函数
3151
+ */
2891
3152
  const offHeadersReceived = callbackManager.headersReceived.remove;
3153
+ /**
3154
+ * 监听进度变化事件
3155
+ * @param {ProgressUpdateCallback} callback HTTP Response Header 事件的回调函数
3156
+ */
2892
3157
  const onProgressUpdate = callbackManager.progressUpdate.add;
3158
+ /**
3159
+ * 取消监听进度变化事件
3160
+ * @param {ProgressUpdateCallback} callback HTTP Response Header 事件的回调函数
3161
+ */
2893
3162
  const offProgressUpdate = callbackManager.progressUpdate.remove;
2894
3163
  return {
2895
3164
  abort,
@@ -2899,6 +3168,10 @@ const createDownloadTask = ({ url, header, success, error }) => {
2899
3168
  offProgressUpdate
2900
3169
  };
2901
3170
  };
3171
+ /**
3172
+ * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径。使用前请注意阅读相关说明。
3173
+ * 注意:请在服务端响应的 header 中指定合理的 Content-Type 字段,以保证客户端正确处理文件类型。
3174
+ */
2902
3175
  const downloadFile = ({ url, header, success, fail, complete }) => {
2903
3176
  let task;
2904
3177
  const result = new Promise((resolve, reject) => {
@@ -2923,6 +3196,7 @@ const downloadFile = ({ url, header, success, fail, complete }) => {
2923
3196
  return result;
2924
3197
  };
2925
3198
 
3199
+ // mDNS
2926
3200
  const stopLocalServiceDiscovery = temporarilyNotSupport('stopLocalServiceDiscovery');
2927
3201
  const startLocalServiceDiscovery = temporarilyNotSupport('startLocalServiceDiscovery');
2928
3202
  const onLocalServiceResolveFail = temporarilyNotSupport('onLocalServiceResolveFail');
@@ -3020,20 +3294,20 @@ function _objectSpread2(target) {
3020
3294
  return target;
3021
3295
  }
3022
3296
 
3023
- function _typeof(obj) {
3297
+ function _typeof$1(obj) {
3024
3298
  "@babel/helpers - typeof";
3025
3299
 
3026
3300
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
3027
- _typeof = function (obj) {
3301
+ _typeof$1 = function (obj) {
3028
3302
  return typeof obj;
3029
3303
  };
3030
3304
  } else {
3031
- _typeof = function (obj) {
3305
+ _typeof$1 = function (obj) {
3032
3306
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3033
3307
  };
3034
3308
  }
3035
3309
 
3036
- return _typeof(obj);
3310
+ return _typeof$1(obj);
3037
3311
  }
3038
3312
 
3039
3313
  function _wrapRegExp() {
@@ -3652,6 +3926,8 @@ function _assertThisInitialized(self) {
3652
3926
  function _possibleConstructorReturn(self, call) {
3653
3927
  if (call && (typeof call === "object" || typeof call === "function")) {
3654
3928
  return call;
3929
+ } else if (call !== void 0) {
3930
+ throw new TypeError("Derived constructors may only return object or undefined");
3655
3931
  }
3656
3932
 
3657
3933
  return _assertThisInitialized(self);
@@ -5167,7 +5443,7 @@ function fetch$1(input, init) {
5167
5443
  }
5168
5444
  }
5169
5445
 
5170
- if (init && _typeof(init.headers) === 'object' && !(init.headers instanceof Headers)) {
5446
+ if (init && _typeof$1(init.headers) === 'object' && !(init.headers instanceof Headers)) {
5171
5447
  Object.getOwnPropertyNames(init.headers).forEach(function (name) {
5172
5448
  xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
5173
5449
  });
@@ -5295,7 +5571,7 @@ var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, sourc
5295
5571
  };
5296
5572
  var enc = encodeURIComponent;
5297
5573
 
5298
- function serializeParams$1(params) {
5574
+ function serializeParams(params) {
5299
5575
  if (!params) {
5300
5576
  return '';
5301
5577
  }
@@ -5305,7 +5581,7 @@ function serializeParams$1(params) {
5305
5581
  }).join('&');
5306
5582
  }
5307
5583
 
5308
- function isFunction$1(fn) {
5584
+ function isFunction(fn) {
5309
5585
  return typeof fn === 'function';
5310
5586
  }
5311
5587
 
@@ -5410,19 +5686,19 @@ try {
5410
5686
 
5411
5687
  store.enabled = !store.disabled;
5412
5688
 
5413
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
5414
- return _typeof(obj);
5689
+ var _typeof = typeof Symbol === "function" && _typeof$1(Symbol.iterator) === "symbol" ? function (obj) {
5690
+ return _typeof$1(obj);
5415
5691
  } : function (obj) {
5416
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
5692
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof$1(obj);
5417
5693
  };
5418
5694
 
5419
5695
  var win = typeof window !== 'undefined' ? window : global;
5420
5696
 
5421
5697
  var canUsePromise = function () {
5422
- return 'Promise' in win && _typeof$1(isFunction$1(Promise));
5698
+ return 'Promise' in win && _typeof(isFunction(Promise));
5423
5699
  }();
5424
5700
 
5425
- var noop = function noop() {};
5701
+ var noop$1 = function noop() {};
5426
5702
 
5427
5703
  var encodeC = encodeURIComponent;
5428
5704
  var doc = win.document;
@@ -5446,16 +5722,16 @@ var defaultConfig = {
5446
5722
  var timestamp = new Date().getTime();
5447
5723
 
5448
5724
  function jsonp$1(url, opts, cb) {
5449
- if (isFunction$1(url)) {
5725
+ if (isFunction(url)) {
5450
5726
  cb = url;
5451
5727
  opts = {};
5452
- } else if (url && (typeof url === 'undefined' ? 'undefined' : _typeof$1(url)) === 'object') {
5728
+ } else if (url && (typeof url === 'undefined' ? 'undefined' : _typeof(url)) === 'object') {
5453
5729
  cb = opts;
5454
5730
  opts = url || {};
5455
5731
  url = opts.url;
5456
5732
  }
5457
5733
 
5458
- if (isFunction$1(opts)) {
5734
+ if (isFunction(opts)) {
5459
5735
  cb = opts;
5460
5736
  opts = {};
5461
5737
  }
@@ -5466,7 +5742,7 @@ function jsonp$1(url, opts, cb) {
5466
5742
 
5467
5743
  opts = objectAssign$1({}, defaultConfig, opts);
5468
5744
  url = url || opts.url;
5469
- cb = cb || noop;
5745
+ cb = cb || noop$1;
5470
5746
 
5471
5747
  if (!url || typeof url !== 'string') {
5472
5748
  cb(new Error('Param url is needed!'));
@@ -5523,7 +5799,7 @@ function jsonp$1(url, opts, cb) {
5523
5799
  }
5524
5800
 
5525
5801
  function generateJsonpUrlWithParams(url, params) {
5526
- params = typeof params === 'string' ? params : serializeParams$1(params);
5802
+ params = typeof params === 'string' ? params : serializeParams(params);
5527
5803
  url += (~url.indexOf('?') ? '&' : '?') + ('' + params);
5528
5804
  url = url.replace('?&', '?');
5529
5805
  return url;
@@ -5609,7 +5885,7 @@ function fetchData(url, opts, cb) {
5609
5885
  script.parentNode.removeChild(script);
5610
5886
  }
5611
5887
 
5612
- win[funcId] = noop;
5888
+ win[funcId] = noop$1;
5613
5889
  clearTimeout(win['timer_' + funcId]);
5614
5890
  }
5615
5891
  }
@@ -5730,15 +6006,17 @@ function appendScriptTagToHead(_ref4) {
5730
6006
  return script;
5731
6007
  }
5732
6008
 
5733
- const { Link } = Taro;
6009
+ // @ts-ignore
6010
+ const { Link: Link$1 } = Taro__default['default'];
5734
6011
  function generateRequestUrlWithParams(url, params) {
5735
- params = typeof params === 'string' ? params : serializeParams(params);
6012
+ params = typeof params === 'string' ? params : serializeParams$1(params);
5736
6013
  if (params) {
5737
6014
  url += (~url.indexOf('?') ? '&' : '?') + params;
5738
6015
  }
5739
6016
  url = url.replace('?&', '?');
5740
6017
  return url;
5741
6018
  }
6019
+ // FIXME 移除 any 标注
5742
6020
  function _request(options) {
5743
6021
  options = options || {};
5744
6022
  if (typeof options === 'string') {
@@ -5789,7 +6067,7 @@ function _request(options) {
5789
6067
  params.body = JSON.stringify(options.data);
5790
6068
  }
5791
6069
  else if (contentType.indexOf('application/x-www-form-urlencoded') >= 0) {
5792
- params.body = serializeParams(options.data);
6070
+ params.body = serializeParams$1(options.data);
5793
6071
  }
5794
6072
  else {
5795
6073
  params.body = options.data;
@@ -5846,12 +6124,14 @@ function _request(options) {
5846
6124
  function taroInterceptor(chain) {
5847
6125
  return _request(chain.requestParams);
5848
6126
  }
5849
- const link = new Link(taroInterceptor);
6127
+ const link = new Link$1(taroInterceptor);
5850
6128
  const request = link.request.bind(link);
5851
6129
  const addInterceptor = link.addInterceptor.bind(link);
5852
6130
 
6131
+ // TCP 通信
5853
6132
  const createTCPSocket = temporarilyNotSupport('createTCPSocket');
5854
6133
 
6134
+ // UDP 通信
5855
6135
  const createUDPSocket = temporarilyNotSupport('createUDPSocket');
5856
6136
 
5857
6137
  const createUploadTask = ({ url, filePath, formData, name, header, timeout, fileName, success, error }) => {
@@ -5905,6 +6185,9 @@ const createUploadTask = ({ url, filePath, formData, name, header, timeout, file
5905
6185
  errMsg: `${apiName}:fail ${e.message}`
5906
6186
  });
5907
6187
  };
6188
+ /**
6189
+ * 中断任务
6190
+ */
5908
6191
  const abort = () => {
5909
6192
  clearTimeout(timeoutInter);
5910
6193
  xhr.abort();
@@ -5936,9 +6219,25 @@ const createUploadTask = ({ url, filePath, formData, name, header, timeout, file
5936
6219
  errMsg: `${apiName}:fail ${e.message}`
5937
6220
  });
5938
6221
  });
6222
+ /**
6223
+ * 监听 HTTP Response Header 事件。会比请求完成事件更早
6224
+ * @param {HeadersReceivedCallback} callback HTTP Response Header 事件的回调函数
6225
+ */
5939
6226
  const onHeadersReceived = callbackManager.headersReceived.add;
6227
+ /**
6228
+ * 取消监听 HTTP Response Header 事件
6229
+ * @param {HeadersReceivedCallback} callback HTTP Response Header 事件的回调函数
6230
+ */
5940
6231
  const offHeadersReceived = callbackManager.headersReceived.remove;
6232
+ /**
6233
+ * 监听进度变化事件
6234
+ * @param {ProgressUpdateCallback} callback HTTP Response Header 事件的回调函数
6235
+ */
5941
6236
  const onProgressUpdate = callbackManager.progressUpdate.add;
6237
+ /**
6238
+ * 取消监听进度变化事件
6239
+ * @param {ProgressUpdateCallback} callback HTTP Response Header 事件的回调函数
6240
+ */
5942
6241
  const offProgressUpdate = callbackManager.progressUpdate.remove;
5943
6242
  const headersReceived = temporarilyNotSupport('UploadTask.headersReceived');
5944
6243
  const progress = temporarilyNotSupport('UploadTask.progress');
@@ -5952,6 +6251,9 @@ const createUploadTask = ({ url, filePath, formData, name, header, timeout, file
5952
6251
  progress
5953
6252
  };
5954
6253
  };
6254
+ /**
6255
+ * 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data。使用前请注意阅读相关说明。
6256
+ */
5955
6257
  const uploadFile = ({ url, filePath, name, header, formData, timeout, fileName, success, fail, complete }) => {
5956
6258
  let task;
5957
6259
  const result = new Promise((resolve, reject) => {
@@ -6019,6 +6321,7 @@ class SocketTask {
6019
6321
  opts = {};
6020
6322
  const { code = 1000, reason = 'server complete,close', success, complete } = opts;
6021
6323
  this.closeDetail = { code, reason };
6324
+ // 主动断开时需要重置链接数
6022
6325
  this._destroyWhenClose && this._destroyWhenClose();
6023
6326
  this.ws.close();
6024
6327
  const res = { errMsg: 'closeSocket:ok' };
@@ -6034,6 +6337,7 @@ class SocketTask {
6034
6337
  }
6035
6338
  onClose(func) {
6036
6339
  this.ws.onclose = () => {
6340
+ // 若服务器方断掉也需要重置链接数
6037
6341
  this._destroyWhenClose && this._destroyWhenClose();
6038
6342
  func(this.closeDetail || { code: 1006, reason: 'abnormal closure' });
6039
6343
  };
@@ -6063,6 +6367,7 @@ function onSocketClose() {
6063
6367
  function connectSocket(options) {
6064
6368
  const name = 'connectSocket';
6065
6369
  return new Promise((resolve, reject) => {
6370
+ // options must be an Object
6066
6371
  const isObject = shouldBeObject(options);
6067
6372
  if (!isObject.flag) {
6068
6373
  const res = { errMsg: `${name}:fail ${isObject.msg}` };
@@ -6071,6 +6376,7 @@ function connectSocket(options) {
6071
6376
  }
6072
6377
  const { url, protocols, success, fail, complete } = options;
6073
6378
  const handle = new MethodHandler({ name, success, fail, complete });
6379
+ // options.url must be String
6074
6380
  if (typeof url !== 'string') {
6075
6381
  return handle.fail({
6076
6382
  errMsg: getParameterError({
@@ -6080,12 +6386,15 @@ function connectSocket(options) {
6080
6386
  })
6081
6387
  }, reject);
6082
6388
  }
6389
+ // options.url must be invalid
6083
6390
  if (!url.startsWith('ws://') && !url.startsWith('wss://')) {
6084
6391
  return handle.fail({
6085
6392
  errMsg: `request:fail invalid url "${url}"`
6086
6393
  }, reject);
6087
6394
  }
6395
+ // protocols must be array
6088
6396
  const _protocols = Array.isArray(protocols) ? protocols : null;
6397
+ // 2 connection at most
6089
6398
  if (socketTasks.length > 1) {
6090
6399
  return handle.fail({
6091
6400
  errMsg: '同时最多发起 2 个 socket 请求,更多请参考文档。'
@@ -6106,16 +6415,21 @@ function closeSocket() {
6106
6415
  console.warn('Deprecated.Please use socketTask.close instead.');
6107
6416
  }
6108
6417
 
6418
+ // 帐号信息
6109
6419
  const getAccountInfoSync = temporarilyNotSupport('getAccountInfoSync');
6110
6420
 
6421
+ // 收货地址
6111
6422
  const chooseAddress = temporarilyNotSupport('chooseAddress');
6112
6423
 
6424
+ // 授权
6113
6425
  const authorizeForMiniProgram = temporarilyNotSupport('authorizeForMiniProgram');
6114
6426
  const authorize = temporarilyNotSupport('authorize');
6115
6427
 
6428
+ // 卡券
6116
6429
  const openCard = temporarilyNotSupport('openCard');
6117
6430
  const addCard = temporarilyNotSupport('addCard');
6118
6431
 
6432
+ // 视频号
6119
6433
  const reserveChannelsLive = temporarilyNotSupport('reserveChannelsLive');
6120
6434
  const openChannelsLive = temporarilyNotSupport('openChannelsLive');
6121
6435
  const openChannelsEvent = temporarilyNotSupport('openChannelsEvent');
@@ -6123,47 +6437,65 @@ const openChannelsActivity = temporarilyNotSupport('openChannelsActivity');
6123
6437
  const getChannelsLiveNoticeInfo = temporarilyNotSupport('getChannelsLiveNoticeInfo');
6124
6438
  const getChannelsLiveInfo = temporarilyNotSupport('getChannelsLiveInfo');
6125
6439
 
6440
+ // 微信客服
6126
6441
  const openCustomerServiceChat = temporarilyNotSupport('openCustomerServiceChat');
6127
6442
 
6443
+ // 过往接口
6128
6444
  const checkIsSupportFacialRecognition = temporarilyNotSupport('checkIsSupportFacialRecognition');
6129
6445
  const startFacialRecognitionVerify = temporarilyNotSupport('startFacialRecognitionVerify');
6130
6446
  const startFacialRecognitionVerifyAndUploadVideo = temporarilyNotSupport('startFacialRecognitionVerifyAndUploadVideo');
6131
6447
  const faceVerifyForPay = temporarilyNotSupport('faceVerifyForPay');
6132
6448
 
6449
+ // 收藏
6133
6450
  const addVideoToFavorites = temporarilyNotSupport('addVideoToFavorites');
6134
6451
  const addFileToFavorites = temporarilyNotSupport('addFileToFavorites');
6135
6452
 
6453
+ // 微信群
6136
6454
  const getGroupEnterInfo = temporarilyNotSupport('getGroupEnterInfo');
6137
6455
 
6456
+ // 发票
6138
6457
  const chooseInvoiceTitle = temporarilyNotSupport('chooseInvoiceTitle');
6139
6458
  const chooseInvoice = temporarilyNotSupport('chooseInvoice');
6140
6459
 
6460
+ // 车牌
6141
6461
  const chooseLicensePlate = temporarilyNotSupport('chooseLicensePlate');
6142
6462
 
6463
+ // 帐号信息
6143
6464
  const pluginLogin = temporarilyNotSupport('pluginLogin');
6144
6465
  const login = temporarilyNotSupport('login');
6145
6466
  const checkSession = temporarilyNotSupport('checkSession');
6146
6467
 
6468
+ // 微信红包
6147
6469
  const showRedPackage = temporarilyNotSupport('showRedPackage');
6148
6470
 
6471
+ // 设置
6149
6472
  const openSetting = temporarilyNotSupport('openSetting');
6150
6473
  const getSetting = temporarilyNotSupport('getSetting');
6151
6474
 
6475
+ // 生物认证
6152
6476
  const startSoterAuthentication = temporarilyNotSupport('startSoterAuthentication');
6153
6477
  const checkIsSupportSoterAuthentication = temporarilyNotSupport('checkIsSupportSoterAuthentication');
6154
6478
  const checkIsSoterEnrolledInDevice = temporarilyNotSupport('checkIsSoterEnrolledInDevice');
6155
6479
 
6480
+ // 订阅消息
6156
6481
  const requestSubscribeMessage = temporarilyNotSupport('requestSubscribeMessage');
6157
6482
 
6483
+ // 用户信息
6158
6484
  const getUserProfile = temporarilyNotSupport('getUserProfile');
6159
6485
  const getUserInfo = temporarilyNotSupport('getUserInfo');
6160
6486
 
6487
+ // 微信运动
6161
6488
  const shareToWeRun = temporarilyNotSupport('shareToWeRun');
6162
6489
  const getWeRunData = temporarilyNotSupport('getWeRunData');
6163
6490
 
6491
+ // 支付
6164
6492
  const requestPayment = temporarilyNotSupport('requestPayment');
6165
6493
  const requestOrderPayment = temporarilyNotSupport('requestOrderPayment');
6166
6494
 
6495
+ // 路由
6496
+ // FIXME 方法导出类型未对齐,后续修复
6497
+
6498
+ // 转发
6167
6499
  const updateShareMenu = temporarilyNotSupport('updateShareMenu');
6168
6500
  const showShareMenu = temporarilyNotSupport('showShareMenu');
6169
6501
  const showShareImageMenu = temporarilyNotSupport('showShareImageMenu');
@@ -6175,6 +6507,10 @@ const hideShareMenu = temporarilyNotSupport('hideShareMenu');
6175
6507
  const getShareInfo = temporarilyNotSupport('getShareInfo');
6176
6508
  const authPrivateMessage = temporarilyNotSupport('authPrivateMessage');
6177
6509
 
6510
+ /**
6511
+ * H5 下的 styleSheet 操作
6512
+ * @author leeenx
6513
+ */
6178
6514
  class StyleSheet {
6179
6515
  constructor() {
6180
6516
  this.appendStyleSheet = () => {
@@ -6187,9 +6523,11 @@ class StyleSheet {
6187
6523
  console.warn('当前浏览器不支持 stylesheet.insertRule 接口');
6188
6524
  }
6189
6525
  };
6526
+ // 添加样式命令
6190
6527
  this.add = (cssText, index = 0) => {
6191
6528
  var _a;
6192
6529
  if (this.sheet === null) {
6530
+ // $style 未插入到 DOM
6193
6531
  this.appendStyleSheet();
6194
6532
  }
6195
6533
  (_a = this.sheet) === null || _a === void 0 ? void 0 : _a.insertRule(cssText, index);
@@ -6198,55 +6536,73 @@ class StyleSheet {
6198
6536
  }
6199
6537
  }
6200
6538
  const styleSheet = new StyleSheet();
6539
+ // 监听事件
6201
6540
  let TRANSITION_END = 'transitionend';
6202
6541
  let TRANSFORM = 'transform';
6203
6542
  const $detect = document.createElement('div');
6204
6543
  $detect.style.cssText = '-webkit-animation-name:webkit;-moz-animation-name:moz;-ms-animation-name:ms;animation-name:standard;';
6205
6544
  if ($detect.style['animation-name'] === 'standard') {
6545
+ // 支持标准写法
6206
6546
  TRANSITION_END = 'transitionend';
6207
6547
  TRANSFORM = 'transform';
6208
6548
  }
6209
6549
  else if ($detect.style['-webkit-animation-name'] === 'webkit') {
6550
+ // webkit 前缀
6210
6551
  TRANSITION_END = 'webkitTransitionEnd';
6211
6552
  TRANSFORM = '-webkit-transform';
6212
6553
  }
6213
6554
  else if ($detect.style['-moz-animation-name'] === 'moz') {
6555
+ // moz 前缀
6214
6556
  TRANSITION_END = 'mozTransitionEnd';
6215
6557
  TRANSFORM = '-moz-transform';
6216
6558
  }
6217
6559
  else if ($detect.style['-ms-animation-name'] === 'ms') {
6560
+ // ms 前缀
6218
6561
  TRANSITION_END = 'msTransitionEnd';
6219
6562
  TRANSFORM = '-ms-transform';
6220
6563
  }
6221
6564
  let animId = 0;
6222
6565
  class Animation {
6223
6566
  constructor({ duration = 400, delay = 0, timingFunction = 'linear', transformOrigin = '50% 50% 0', unit = 'px' } = {}) {
6567
+ // 属性组合
6224
6568
  this.rules = [];
6569
+ // transform 对象
6225
6570
  this.transform = [`${TRANSFORM}:`];
6571
+ // 组合动画
6226
6572
  this.steps = [];
6573
+ // 动画 map ----- 永久保留
6227
6574
  this.animationMap = {};
6575
+ // animationMap 的长度
6228
6576
  this.animationMapCount = 0;
6577
+ // 默认值
6229
6578
  this.setDefault(duration, delay, timingFunction, transformOrigin);
6230
6579
  this.unit = unit;
6580
+ // atom 环境下,animation 属性不会显示,所以要改成 data-animation
6231
6581
  let animAttr = 'animation';
6582
+ // 动画 id
6232
6583
  this.id = ++animId;
6584
+ // 监听事件
6233
6585
  document.body.addEventListener(TRANSITION_END, (e) => {
6234
6586
  const target = e.target;
6235
6587
  if (target.getAttribute(animAttr) === null) {
6236
6588
  animAttr = 'data-animation';
6237
6589
  }
6238
6590
  const animData = target.getAttribute(animAttr);
6591
+ // 没有动画存在
6239
6592
  if (animData === null)
6240
6593
  return;
6241
6594
  const [animName, animPath] = animData.split('__');
6242
6595
  if (animName === `taro-h5-poly-fill/${this.id}/create-animation`) {
6243
6596
  const [animIndex, __stepIndex = 0] = animPath.split('--');
6244
6597
  const stepIndex = Number(__stepIndex);
6598
+ // 动画总的关键帧
6245
6599
  const animStepsCount = this.animationMap[`${animName}__${animIndex}`];
6246
6600
  const animStepsMaxIndex = animStepsCount - 1;
6247
6601
  if (stepIndex < animStepsMaxIndex) {
6602
+ // 播放下一个关键帧(因为 nerv 和 react 有差异所以 animation & data-animation 都需要写)
6248
6603
  target.setAttribute(animAttr, `${animName}__${animIndex}--${stepIndex + 1}`);
6249
6604
  if (animAttr === 'animation') {
6605
+ // Nerv 环境,animation & data-animation 双重保险
6250
6606
  target.setAttribute('data-animation', `${animName}__${animIndex}--${stepIndex + 1}`);
6251
6607
  }
6252
6608
  }
@@ -6260,6 +6616,7 @@ class Animation {
6260
6616
  });
6261
6617
  return ret;
6262
6618
  }
6619
+ // 设置默认值
6263
6620
  setDefault(duration, delay, timingFunction, transformOrigin) {
6264
6621
  this.DEFAULT = { duration, delay, timingFunction, transformOrigin };
6265
6622
  }
@@ -6391,9 +6748,11 @@ class Animation {
6391
6748
  this.rules.push(`left: ${value}`);
6392
6749
  return this;
6393
6750
  }
6751
+ // 关键帧载入
6394
6752
  step(arg = {}) {
6395
6753
  const { DEFAULT } = this;
6396
6754
  const { duration = DEFAULT.duration, delay = DEFAULT.delay, timingFunction = DEFAULT.timingFunction, transformOrigin = DEFAULT.transformOrigin } = arg;
6755
+ // 生成一条 transition 动画
6397
6756
  this.steps.push([
6398
6757
  this.rules.map(rule => `${rule}!important`).join(';'),
6399
6758
  `${this.transform.join(' ')}!important`,
@@ -6402,41 +6761,54 @@ class Animation {
6402
6761
  ]
6403
6762
  .filter(item => item !== '' && item !== `${TRANSFORM}:`)
6404
6763
  .join(';'));
6764
+ // 清空 rules 和 transform
6405
6765
  this.rules = [];
6406
6766
  this.transform = [`${TRANSFORM}:`];
6407
6767
  return this;
6408
6768
  }
6769
+ // 创建底层数据
6409
6770
  createAnimationData() {
6410
6771
  const animIndex = `taro-h5-poly-fill/${this.id}/create-animation__${this.animationMapCount++}`;
6772
+ // 记录动画分几个 step
6411
6773
  this.animationMap[animIndex] = this.steps.length;
6774
+ // 吐出 step
6412
6775
  this.steps.forEach((step, index) => {
6413
6776
  const selector = index === 0
6414
6777
  ? `[animation="${animIndex}"], [data-animation="${animIndex}"]`
6415
6778
  : `[animation="${animIndex}--${index}"], [data-animation="${animIndex}--${index}"]`;
6416
6779
  styleSheet.add(`${selector} { ${step} }`);
6417
6780
  });
6781
+ // 清空 steps
6418
6782
  this.steps = [];
6419
6783
  return animIndex;
6420
6784
  }
6785
+ // 动画数据产出
6421
6786
  export() {
6422
6787
  return this.createAnimationData();
6423
6788
  }
6424
6789
  }
6790
+ // h5 的 createAnimation
6425
6791
  const createAnimation = (option) => {
6426
6792
  return new Animation(option);
6427
6793
  };
6428
6794
 
6795
+ // 背景
6429
6796
  const setBackgroundTextStyle = temporarilyNotSupport('setBackgroundTextStyle');
6430
6797
  const setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
6431
6798
 
6432
- const nextTick = Taro.nextTick;
6799
+ // 自定义组件
6800
+ const nextTick = Taro__default['default'].nextTick;
6433
6801
 
6802
+ // 字体
6434
6803
  const loadFontFace = temporarilyNotSupport('loadFontFace');
6435
6804
 
6805
+ // 菜单
6436
6806
  const getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect');
6437
6807
 
6808
+ // 导航栏
6438
6809
  const showNavigationBarLoading = temporarilyNotSupport('showNavigationBarLoading');
6439
6810
  function setNavigationBarTitle(options) {
6811
+ // options must be an Object
6440
6812
  const isObject = shouldBeObject(options);
6441
6813
  if (!isObject.flag) {
6442
6814
  const res = { errMsg: `setNavigationBarTitle:fail ${isObject.msg}` };
@@ -6459,6 +6831,9 @@ function setNavigationBarTitle(options) {
6459
6831
  }
6460
6832
  return handle.success();
6461
6833
  }
6834
+ /**
6835
+ * 设置页面导航条颜色
6836
+ */
6462
6837
  const setNavigationBarColor = (options) => {
6463
6838
  const { backgroundColor, success, fail, complete } = options;
6464
6839
  const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete });
@@ -6471,19 +6846,25 @@ const setNavigationBarColor = (options) => {
6471
6846
  const hideNavigationBarLoading = temporarilyNotSupport('hideNavigationBarLoading');
6472
6847
  const hideHomeButton = temporarilyNotSupport('hideHomeButton');
6473
6848
 
6849
+ /**
6850
+ * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
6851
+ */
6474
6852
  const startPullDownRefresh = function ({ success, fail, complete } = {}) {
6475
6853
  const handle = new MethodHandler({ name: 'startPullDownRefresh', success, fail, complete });
6476
6854
  return new Promise((resolve, reject) => {
6477
- Taro.eventCenter.trigger('__taroStartPullDownRefresh', {
6855
+ Taro__default['default'].eventCenter.trigger('__taroStartPullDownRefresh', {
6478
6856
  successHandler: (res = {}) => handle.success(res, resolve),
6479
6857
  errorHandler: (res = {}) => handle.fail(res, reject)
6480
6858
  });
6481
6859
  });
6482
6860
  };
6861
+ /**
6862
+ * 停止当前页面下拉刷新。
6863
+ */
6483
6864
  const stopPullDownRefresh = function ({ success, fail, complete } = {}) {
6484
6865
  const handle = new MethodHandler({ name: 'stopPullDownRefresh', success, fail, complete });
6485
6866
  return new Promise((resolve, reject) => {
6486
- Taro.eventCenter.trigger('__taroStopPullDownRefresh', {
6867
+ Taro__default['default'].eventCenter.trigger('__taroStopPullDownRefresh', {
6487
6868
  successHandler: (res = {}) => handle.success(res, resolve),
6488
6869
  errorHandler: (res = {}) => handle.fail(res, reject)
6489
6870
  });
@@ -6492,6 +6873,9 @@ const stopPullDownRefresh = function ({ success, fail, complete } = {}) {
6492
6873
 
6493
6874
  let timer;
6494
6875
  const FRAME_DURATION = 17;
6876
+ /**
6877
+ * 将页面滚动到目标位置
6878
+ */
6495
6879
  const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail, complete }) => {
6496
6880
  let scrollFunc;
6497
6881
  const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete });
@@ -6568,13 +6952,18 @@ const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail,
6568
6952
  });
6569
6953
  };
6570
6954
 
6955
+ // 置顶
6571
6956
  const setTopBarText = temporarilyNotSupport('setTopBarText');
6572
6957
 
6573
6958
  let tabConf;
6574
6959
  function initTabBarApis(config = {}) {
6575
6960
  tabConf = config.tabBar;
6576
6961
  }
6962
+ /**
6963
+ * 显示 tabBar 某一项的右上角的红点
6964
+ */
6577
6965
  const showTabBarRedDot = (options) => {
6966
+ // options must be an Object
6578
6967
  const isObject = shouldBeObject(options);
6579
6968
  if (!isObject.flag) {
6580
6969
  const res = { errMsg: `showTabBarRedDot:fail ${isObject.msg}` };
@@ -6593,14 +6982,18 @@ const showTabBarRedDot = (options) => {
6593
6982
  });
6594
6983
  }
6595
6984
  return new Promise((resolve, reject) => {
6596
- Taro.eventCenter.trigger('__taroShowTabBarRedDotHandler', {
6985
+ Taro__default['default'].eventCenter.trigger('__taroShowTabBarRedDotHandler', {
6597
6986
  index,
6598
6987
  successHandler: (res = {}) => handle.success(res, resolve),
6599
6988
  errorHandler: (res = {}) => handle.fail(res, reject)
6600
6989
  });
6601
6990
  });
6602
6991
  };
6992
+ /**
6993
+ * 显示 tabBar
6994
+ */
6603
6995
  const showTabBar = (options = {}) => {
6996
+ // options must be an Object
6604
6997
  const isObject = shouldBeObject(options);
6605
6998
  if (!isObject.flag) {
6606
6999
  const res = { errMsg: `showTabBar:fail ${isObject.msg}` };
@@ -6619,14 +7012,18 @@ const showTabBar = (options = {}) => {
6619
7012
  });
6620
7013
  }
6621
7014
  return new Promise((resolve, reject) => {
6622
- Taro.eventCenter.trigger('__taroShowTabBar', {
7015
+ Taro__default['default'].eventCenter.trigger('__taroShowTabBar', {
6623
7016
  animation,
6624
7017
  successHandler: (res = {}) => handle.success(res, resolve),
6625
7018
  errorHandler: (res = {}) => handle.fail(res, reject)
6626
7019
  });
6627
7020
  });
6628
7021
  };
7022
+ /**
7023
+ * 动态设置 tabBar 的整体样式
7024
+ */
6629
7025
  const setTabBarStyle = (options = {}) => {
7026
+ // options must be an Object
6630
7027
  const isObject = shouldBeObject(options);
6631
7028
  if (!isObject.flag) {
6632
7029
  const res = { errMsg: `setTabBarStyle:fail ${isObject.msg}` };
@@ -6664,7 +7061,7 @@ const setTabBarStyle = (options = {}) => {
6664
7061
  if (borderStyle)
6665
7062
  obj.borderStyle = borderStyle;
6666
7063
  return new Promise((resolve, reject) => {
6667
- Taro.eventCenter.trigger('__taroSetTabBarStyle', {
7064
+ Taro__default['default'].eventCenter.trigger('__taroSetTabBarStyle', {
6668
7065
  color,
6669
7066
  selectedColor,
6670
7067
  backgroundColor,
@@ -6674,7 +7071,11 @@ const setTabBarStyle = (options = {}) => {
6674
7071
  });
6675
7072
  });
6676
7073
  };
7074
+ /**
7075
+ * 动态设置 tabBar 某一项的内容
7076
+ */
6677
7077
  const setTabBarItem = (options) => {
7078
+ // options must be an Object
6678
7079
  const isObject = shouldBeObject(options);
6679
7080
  if (!isObject.flag) {
6680
7081
  const res = { errMsg: `setTabBarItem:fail ${isObject.msg}` };
@@ -6693,7 +7094,7 @@ const setTabBarItem = (options) => {
6693
7094
  });
6694
7095
  }
6695
7096
  return new Promise((resolve, reject) => {
6696
- Taro.eventCenter.trigger('__taroSetTabBarItem', {
7097
+ Taro__default['default'].eventCenter.trigger('__taroSetTabBarItem', {
6697
7098
  index,
6698
7099
  text,
6699
7100
  iconPath,
@@ -6703,7 +7104,11 @@ const setTabBarItem = (options) => {
6703
7104
  });
6704
7105
  });
6705
7106
  };
7107
+ /**
7108
+ * 为 tabBar 某一项的右上角添加文本
7109
+ */
6706
7110
  const setTabBarBadge = (options) => {
7111
+ // options must be an Object
6707
7112
  const isObject = shouldBeObject(options);
6708
7113
  if (!isObject.flag) {
6709
7114
  const res = { errMsg: `setTabBarBadge:fail ${isObject.msg}` };
@@ -6731,7 +7136,7 @@ const setTabBarBadge = (options) => {
6731
7136
  });
6732
7137
  }
6733
7138
  return new Promise((resolve, reject) => {
6734
- Taro.eventCenter.trigger('__taroSetTabBarBadge', {
7139
+ Taro__default['default'].eventCenter.trigger('__taroSetTabBarBadge', {
6735
7140
  index,
6736
7141
  text,
6737
7142
  successHandler: (res = {}) => handle.success(res, resolve),
@@ -6739,7 +7144,11 @@ const setTabBarBadge = (options) => {
6739
7144
  });
6740
7145
  });
6741
7146
  };
7147
+ /**
7148
+ * 移除 tabBar 某一项右上角的文本
7149
+ */
6742
7150
  const removeTabBarBadge = (options) => {
7151
+ // options must be an Object
6743
7152
  const isObject = shouldBeObject(options);
6744
7153
  if (!isObject.flag) {
6745
7154
  const res = { errMsg: `removeTabBarBadge:fail ${isObject.msg}` };
@@ -6758,14 +7167,18 @@ const removeTabBarBadge = (options) => {
6758
7167
  });
6759
7168
  }
6760
7169
  return new Promise((resolve, reject) => {
6761
- Taro.eventCenter.trigger('__taroRemoveTabBarBadge', {
7170
+ Taro__default['default'].eventCenter.trigger('__taroRemoveTabBarBadge', {
6762
7171
  index,
6763
7172
  successHandler: (res = {}) => handle.success(res, resolve),
6764
7173
  errorHandler: (res = {}) => handle.fail(res, reject)
6765
7174
  });
6766
7175
  });
6767
7176
  };
7177
+ /**
7178
+ * 隐藏 tabBar 某一项的右上角的红点
7179
+ */
6768
7180
  const hideTabBarRedDot = (options) => {
7181
+ // options must be an Object
6769
7182
  const isObject = shouldBeObject(options);
6770
7183
  if (!isObject.flag) {
6771
7184
  const res = { errMsg: `hideTabBarRedDot:fail ${isObject.msg}` };
@@ -6784,14 +7197,18 @@ const hideTabBarRedDot = (options) => {
6784
7197
  });
6785
7198
  }
6786
7199
  return new Promise((resolve, reject) => {
6787
- Taro.eventCenter.trigger('__taroHideTabBarRedDotHandler', {
7200
+ Taro__default['default'].eventCenter.trigger('__taroHideTabBarRedDotHandler', {
6788
7201
  index,
6789
7202
  successHandler: (res = {}) => handle.success(res, resolve),
6790
7203
  errorHandler: (res = {}) => handle.fail(res, reject)
6791
7204
  });
6792
7205
  });
6793
7206
  };
7207
+ /**
7208
+ * 隐藏 tabBar
7209
+ */
6794
7210
  const hideTabBar = (options = {}) => {
7211
+ // options must be an Object
6795
7212
  const isObject = shouldBeObject(options);
6796
7213
  if (!isObject.flag) {
6797
7214
  const res = { errMsg: `hideTabBar:fail ${isObject.msg}` };
@@ -6810,7 +7227,7 @@ const hideTabBar = (options = {}) => {
6810
7227
  });
6811
7228
  }
6812
7229
  return new Promise((resolve, reject) => {
6813
- Taro.eventCenter.trigger('__taroHideTabBar', {
7230
+ Taro__default['default'].eventCenter.trigger('__taroHideTabBar', {
6814
7231
  animation,
6815
7232
  successHandler: (res = {}) => handle.success(res, resolve),
6816
7233
  errorHandler: (res = {}) => handle.fail(res, reject)
@@ -6818,23 +7235,32 @@ const hideTabBar = (options = {}) => {
6818
7235
  });
6819
7236
  };
6820
7237
 
6821
- const callbackManager$3 = new CallbackManager();
7238
+ const callbackManager = new CallbackManager();
6822
7239
  const resizeListener = () => {
6823
- callbackManager$3.trigger({
7240
+ callbackManager.trigger({
6824
7241
  windowWidth: window.screen.width,
6825
7242
  windowHeight: window.screen.height
6826
7243
  });
6827
7244
  };
7245
+ /**
7246
+ * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南
7247
+ */
6828
7248
  const setWindowSize = temporarilyNotSupport('setWindowSize');
7249
+ /**
7250
+ * 监听窗口尺寸变化事件
7251
+ */
6829
7252
  const onWindowResize = callback => {
6830
- callbackManager$3.add(callback);
6831
- if (callbackManager$3.count() === 1) {
7253
+ callbackManager.add(callback);
7254
+ if (callbackManager.count() === 1) {
6832
7255
  window.addEventListener('resize', resizeListener);
6833
7256
  }
6834
7257
  };
7258
+ /**
7259
+ * 取消监听窗口尺寸变化事件
7260
+ */
6835
7261
  const offWindowResize = callback => {
6836
- callbackManager$3.remove(callback);
6837
- if (callbackManager$3.count() === 0) {
7262
+ callbackManager.remove(callback);
7263
+ if (callbackManager.count() === 0) {
6838
7264
  window.removeEventListener('resize', resizeListener);
6839
7265
  }
6840
7266
  };
@@ -6915,19 +7341,24 @@ class Toast {
6915
7341
  };
6916
7342
  }
6917
7343
  create(options = {}, _type = 'toast') {
7344
+ // style
6918
7345
  const { maskStyle, toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle, textStyle } = this.style;
7346
+ // configuration
6919
7347
  const config = {
6920
7348
  ...this.options,
6921
7349
  ...options,
6922
7350
  _type
6923
7351
  };
7352
+ // wrapper
6924
7353
  this.el = document.createElement('div');
6925
7354
  this.el.className = 'taro__toast';
6926
7355
  this.el.style.opacity = '0';
6927
7356
  this.el.style.transition = 'opacity 0.1s linear';
7357
+ // mask
6928
7358
  this.mask = document.createElement('div');
6929
7359
  this.mask.setAttribute('style', inlineStyle(maskStyle));
6930
7360
  this.mask.style.display = config.mask ? 'block' : 'none';
7361
+ // icon
6931
7362
  this.icon = document.createElement('p');
6932
7363
  if (config.image) {
6933
7364
  this.icon.setAttribute('style', inlineStyle({
@@ -6942,6 +7373,7 @@ class Toast {
6942
7373
  ...(config.icon === 'none' ? { display: 'none' } : {})
6943
7374
  }));
6944
7375
  }
7376
+ // toast
6945
7377
  this.toast = document.createElement('div');
6946
7378
  this.toast.setAttribute('style', inlineStyle({
6947
7379
  ...toastStyle,
@@ -6950,16 +7382,20 @@ class Toast {
6950
7382
  padding: '10px 15px'
6951
7383
  } : {})
6952
7384
  }));
7385
+ // title
6953
7386
  this.title = document.createElement('p');
6954
7387
  this.title.setAttribute('style', inlineStyle(textStyle));
6955
7388
  this.title.textContent = config.title;
7389
+ // result
6956
7390
  this.toast.appendChild(this.icon);
6957
7391
  this.toast.appendChild(this.title);
6958
7392
  this.el.appendChild(this.mask);
6959
7393
  this.el.appendChild(this.toast);
7394
+ // show immediately
6960
7395
  document.body.appendChild(this.el);
6961
7396
  setTimeout(() => { this.el.style.opacity = '1'; }, 0);
6962
7397
  this.type = config._type;
7398
+ // disappear after duration
6963
7399
  config.duration >= 0 && this.hide(config.duration, this.type);
6964
7400
  return '';
6965
7401
  }
@@ -6973,8 +7409,11 @@ class Toast {
6973
7409
  clearTimeout(this.hideOpacityTimer);
6974
7410
  if (this.hideDisplayTimer)
6975
7411
  clearTimeout(this.hideDisplayTimer);
7412
+ // title
6976
7413
  this.title.textContent = config.title || '';
7414
+ // mask
6977
7415
  this.mask.style.display = config.mask ? 'block' : 'none';
7416
+ // image
6978
7417
  const { toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle } = this.style;
6979
7418
  if (config.image) {
6980
7419
  this.icon.setAttribute('style', inlineStyle({
@@ -6991,6 +7430,7 @@ class Toast {
6991
7430
  }));
6992
7431
  }
6993
7432
  }
7433
+ // toast
6994
7434
  this.toast.setAttribute('style', inlineStyle({
6995
7435
  ...toastStyle,
6996
7436
  ...(config.icon === 'none' ? {
@@ -6998,9 +7438,11 @@ class Toast {
6998
7438
  padding: '10px 15px'
6999
7439
  } : {})
7000
7440
  }));
7441
+ // show
7001
7442
  this.el.style.display = 'block';
7002
7443
  setTimeout(() => { this.el.style.opacity = '1'; }, 0);
7003
7444
  this.type = config._type;
7445
+ // disappear after duration
7004
7446
  config.duration >= 0 && this.hide(config.duration, this.type);
7005
7447
  return '';
7006
7448
  }
@@ -7080,21 +7522,27 @@ class Modal {
7080
7522
  }
7081
7523
  create(options = {}) {
7082
7524
  return new Promise((resolve) => {
7525
+ // style
7083
7526
  const { maskStyle, modalStyle, titleStyle, textStyle, footStyle, btnStyle } = this.style;
7527
+ // configuration
7084
7528
  const config = {
7085
7529
  ...this.options,
7086
7530
  ...options
7087
7531
  };
7532
+ // wrapper
7088
7533
  this.el = document.createElement('div');
7089
7534
  this.el.className = 'taro__modal';
7090
7535
  this.el.style.opacity = '0';
7091
7536
  this.el.style.transition = 'opacity 0.2s linear';
7537
+ // mask
7092
7538
  const mask = document.createElement('div');
7093
7539
  mask.className = 'taro-modal__mask';
7094
7540
  mask.setAttribute('style', inlineStyle(maskStyle));
7541
+ // modal
7095
7542
  const modal = document.createElement('div');
7096
7543
  modal.className = 'taro-modal__content';
7097
7544
  modal.setAttribute('style', inlineStyle(modalStyle));
7545
+ // title
7098
7546
  const titleCSS = config.title ? titleStyle : {
7099
7547
  ...titleStyle,
7100
7548
  display: 'none'
@@ -7103,6 +7551,7 @@ class Modal {
7103
7551
  this.title.className = 'taro-modal__title';
7104
7552
  this.title.setAttribute('style', inlineStyle(titleCSS));
7105
7553
  this.title.textContent = config.title;
7554
+ // text
7106
7555
  const textCSS = config.title ? textStyle : {
7107
7556
  ...textStyle,
7108
7557
  padding: '40px 20px 26px',
@@ -7112,9 +7561,11 @@ class Modal {
7112
7561
  this.text.className = 'taro-modal__text';
7113
7562
  this.text.setAttribute('style', inlineStyle(textCSS));
7114
7563
  this.text.textContent = config.content;
7564
+ // foot
7115
7565
  const foot = document.createElement('div');
7116
7566
  foot.className = 'taro-modal__foot';
7117
7567
  foot.setAttribute('style', inlineStyle(footStyle));
7568
+ // cancel button
7118
7569
  const cancelCSS = {
7119
7570
  ...btnStyle,
7120
7571
  color: config.cancelColor,
@@ -7128,6 +7579,7 @@ class Modal {
7128
7579
  this.hide();
7129
7580
  resolve('cancel');
7130
7581
  };
7582
+ // confirm button
7131
7583
  this.confirm = document.createElement('div');
7132
7584
  this.confirm.className = 'taro-model__btn taro-model__confirm';
7133
7585
  this.confirm.setAttribute('style', inlineStyle(btnStyle));
@@ -7137,6 +7589,7 @@ class Modal {
7137
7589
  this.hide();
7138
7590
  resolve('confirm');
7139
7591
  };
7592
+ // result
7140
7593
  foot.appendChild(this.cancel);
7141
7594
  foot.appendChild(this.confirm);
7142
7595
  modal.appendChild(this.title);
@@ -7144,6 +7597,7 @@ class Modal {
7144
7597
  modal.appendChild(foot);
7145
7598
  this.el.appendChild(mask);
7146
7599
  this.el.appendChild(modal);
7600
+ // show immediately
7147
7601
  document.body.appendChild(this.el);
7148
7602
  setTimeout(() => { this.el.style.opacity = '1'; }, 0);
7149
7603
  });
@@ -7158,13 +7612,16 @@ class Modal {
7158
7612
  clearTimeout(this.hideOpacityTimer);
7159
7613
  if (this.hideDisplayTimer)
7160
7614
  clearTimeout(this.hideDisplayTimer);
7615
+ // title & text
7161
7616
  const { textStyle } = this.style;
7162
7617
  if (config.title) {
7163
7618
  this.title.textContent = config.title;
7619
+ // none => block
7164
7620
  this.title.style.display = 'block';
7165
7621
  this.text.setAttribute('style', inlineStyle(textStyle));
7166
7622
  }
7167
7623
  else {
7624
+ // block => none
7168
7625
  this.title.style.display = 'none';
7169
7626
  const textCSS = {
7170
7627
  ...textStyle,
@@ -7174,11 +7631,17 @@ class Modal {
7174
7631
  this.text.setAttribute('style', inlineStyle(textCSS));
7175
7632
  }
7176
7633
  this.text.textContent = config.content || '';
7634
+ // showCancel
7177
7635
  this.cancel.style.display = config.showCancel ? 'block' : 'none';
7636
+ // cancelText
7178
7637
  this.cancel.textContent = config.cancelText || '';
7638
+ // cancelColor
7179
7639
  this.cancel.style.color = config.cancelColor || '';
7640
+ // confirmText
7180
7641
  this.confirm.textContent = config.confirmText || '';
7642
+ // confirmColor
7181
7643
  this.confirm.style.color = config.confirmColor || '';
7644
+ // cbs
7182
7645
  this.cancel.onclick = () => {
7183
7646
  this.hide();
7184
7647
  resolve('cancel');
@@ -7187,6 +7650,7 @@ class Modal {
7187
7650
  this.hide();
7188
7651
  resolve('confirm');
7189
7652
  };
7653
+ // show
7190
7654
  this.el.style.display = 'block';
7191
7655
  setTimeout(() => { this.el.style.opacity = '1'; }, 0);
7192
7656
  });
@@ -7203,15 +7667,15 @@ class Modal {
7203
7667
  }
7204
7668
  }
7205
7669
 
7206
- const noop$1 = function () { };
7670
+ const noop = function () { };
7207
7671
  class ActionSheet {
7208
7672
  constructor() {
7209
7673
  this.options = {
7210
7674
  itemList: [],
7211
7675
  itemColor: '#000000',
7212
- success: noop$1,
7213
- fail: noop$1,
7214
- complete: noop$1
7676
+ success: noop,
7677
+ fail: noop,
7678
+ complete: noop
7215
7679
  };
7216
7680
  this.style = {
7217
7681
  maskStyle: {
@@ -7258,25 +7722,32 @@ class ActionSheet {
7258
7722
  }
7259
7723
  create(options = {}) {
7260
7724
  return new Promise((resolve) => {
7725
+ // style
7261
7726
  const { maskStyle, actionSheetStyle, menuStyle, cellStyle, cancelStyle } = this.style;
7727
+ // configuration
7262
7728
  const config = {
7263
7729
  ...this.options,
7264
7730
  ...options
7265
7731
  };
7266
7732
  this.lastConfig = config;
7733
+ // wrapper
7267
7734
  this.el = document.createElement('div');
7268
7735
  this.el.className = 'taro__actionSheet';
7269
7736
  this.el.style.opacity = '0';
7270
7737
  this.el.style.transition = 'opacity 0.2s linear';
7738
+ // mask
7271
7739
  const mask = document.createElement('div');
7272
7740
  mask.setAttribute('style', inlineStyle(maskStyle));
7741
+ // actionSheet
7273
7742
  this.actionSheet = document.createElement('div');
7274
7743
  this.actionSheet.setAttribute('style', inlineStyle(actionSheetStyle));
7744
+ // menu
7275
7745
  this.menu = document.createElement('div');
7276
7746
  this.menu.setAttribute('style', inlineStyle({
7277
7747
  ...menuStyle,
7278
7748
  color: config.itemColor
7279
7749
  }));
7750
+ // cells
7280
7751
  this.cells = config.itemList.map((item, index) => {
7281
7752
  const cell = document.createElement('div');
7282
7753
  cell.className = 'taro-actionsheet__cell';
@@ -7291,20 +7762,24 @@ class ActionSheet {
7291
7762
  };
7292
7763
  return cell;
7293
7764
  });
7765
+ // cancel
7294
7766
  this.cancel = document.createElement('div');
7295
7767
  this.cancel.setAttribute('style', inlineStyle(cancelStyle));
7296
7768
  this.cancel.textContent = '取消';
7769
+ // result
7297
7770
  this.cells.forEach(item => this.menu.appendChild(item));
7298
7771
  this.actionSheet.appendChild(this.menu);
7299
7772
  this.actionSheet.appendChild(this.cancel);
7300
7773
  this.el.appendChild(mask);
7301
7774
  this.el.appendChild(this.actionSheet);
7775
+ // callbacks
7302
7776
  const cb = () => {
7303
7777
  this.hide();
7304
7778
  resolve('cancel');
7305
7779
  };
7306
7780
  mask.onclick = cb;
7307
7781
  this.cancel.onclick = cb;
7782
+ // show immediately
7308
7783
  document.body.appendChild(this.el);
7309
7784
  setTimeout(() => {
7310
7785
  this.el.style.opacity = '1';
@@ -7323,15 +7798,19 @@ class ActionSheet {
7323
7798
  clearTimeout(this.hideOpacityTimer);
7324
7799
  if (this.hideDisplayTimer)
7325
7800
  clearTimeout(this.hideDisplayTimer);
7801
+ // itemColor
7326
7802
  if (config.itemColor)
7327
7803
  this.menu.style.color = config.itemColor;
7804
+ // cells
7328
7805
  const { cellStyle } = this.style;
7329
7806
  config.itemList.forEach((item, index) => {
7330
7807
  let cell;
7331
7808
  if (this.cells[index]) {
7809
+ // assign new content
7332
7810
  cell = this.cells[index];
7333
7811
  }
7334
7812
  else {
7813
+ // create new cell
7335
7814
  cell = document.createElement('div');
7336
7815
  cell.className = 'taro-actionsheet__cell';
7337
7816
  cell.setAttribute('style', inlineStyle(cellStyle));
@@ -7355,6 +7834,7 @@ class ActionSheet {
7355
7834
  }
7356
7835
  this.cells.splice(itemListLen);
7357
7836
  }
7837
+ // show
7358
7838
  this.el.style.display = 'block';
7359
7839
  setTimeout(() => {
7360
7840
  this.el.style.opacity = '1';
@@ -7375,7 +7855,9 @@ class ActionSheet {
7375
7855
  }
7376
7856
  }
7377
7857
 
7858
+ // 交互
7378
7859
  let status = 'default';
7860
+ // inject necessary style
7379
7861
  function init(doc) {
7380
7862
  if (status === 'ready')
7381
7863
  return;
@@ -7553,14 +8035,16 @@ const showModal = async (options = {}) => {
7553
8035
  });
7554
8036
  }
7555
8037
  options.showCancel = !!options.showCancel;
7556
- let errMsg = '';
8038
+ let result = '';
7557
8039
  if (!modal.el) {
7558
- errMsg = await modal.create(options);
8040
+ result = await modal.create(options);
7559
8041
  }
7560
8042
  else {
7561
- errMsg = await modal.show(options);
8043
+ result = await modal.show(options);
7562
8044
  }
7563
- return handle.success({ errMsg });
8045
+ const res = { cancel: !1, confirm: !1 };
8046
+ res[result] = !0;
8047
+ return handle.success(res);
7564
8048
  };
7565
8049
  function hideModal() {
7566
8050
  if (!modal.el)
@@ -7575,6 +8059,7 @@ const showActionSheet = async (options = { itemList: [] }) => {
7575
8059
  }, options);
7576
8060
  const { success, fail, complete } = options;
7577
8061
  const handle = new MethodHandler({ name: 'showActionSheet', success, fail, complete });
8062
+ // list item String
7578
8063
  if (!Array.isArray(options.itemList)) {
7579
8064
  return handle.fail({
7580
8065
  errMsg: getParameterError({
@@ -7624,7 +8109,7 @@ const showActionSheet = async (options = { itemList: [] }) => {
7624
8109
  return handle.success(({ tapIndex: result }));
7625
8110
  }
7626
8111
  };
7627
- Taro.eventCenter.on('__taroRouterChange', () => {
8112
+ Taro__default['default'].eventCenter.on('__taroRouterChange', () => {
7628
8113
  hideToast();
7629
8114
  hideLoading();
7630
8115
  hideModal();
@@ -7632,6 +8117,7 @@ Taro.eventCenter.on('__taroRouterChange', () => {
7632
8117
  const enableAlertBeforeUnload = temporarilyNotSupport('enableAlertBeforeUnload');
7633
8118
  const disableAlertBeforeUnload = temporarilyNotSupport('disableAlertBeforeUnload');
7634
8119
 
8120
+ // Worker
7635
8121
  const createWorker = temporarilyNotSupport('createWorker');
7636
8122
 
7637
8123
  class NodesRef {
@@ -7701,6 +8187,8 @@ function filter(fields, dom, selector) {
7701
8187
  }
7702
8188
  }
7703
8189
  else {
8190
+ // TODO https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html
8191
+ // if (/^taro-scroll-view-core/i.test(tagName))
7704
8192
  res.nodeCanvasType = '';
7705
8193
  res.node = dom;
7706
8194
  }
@@ -7709,6 +8197,7 @@ function filter(fields, dom, selector) {
7709
8197
  if (context) {
7710
8198
  const tagName = dom.tagName;
7711
8199
  if (/^taro-video-core/i.test(tagName)) {
8200
+ // TODO HTMLVideoElement to VideoContext
7712
8201
  return { context: dom };
7713
8202
  }
7714
8203
  else if (/^taro-canvas-core/i.test(tagName)) {
@@ -7780,14 +8269,22 @@ function filter(fields, dom, selector) {
7780
8269
  }
7781
8270
  return res;
7782
8271
  }
8272
+ /**
8273
+ * WXML节点信息API
8274
+ * @return {Object} SelectorQuery 对象实例
8275
+ */
7783
8276
  function queryBat(queue, cb) {
7784
8277
  const result = [];
7785
8278
  queue.forEach(item => {
7786
8279
  var _a;
7787
8280
  const { selector, single, fields, component } = item;
8281
+ // selector 的容器节点
8282
+ /* eslint-disable */
7788
8283
  const container = (component !== null ?
7789
8284
  (findDOM(component) || document) :
7790
8285
  document);
8286
+ /* eslint-enable */
8287
+ // 特殊处理 ---- 选自己
7791
8288
  let selectSelf = false;
7792
8289
  if (container !== document) {
7793
8290
  const $nodeList = (_a = container.parentNode) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector);
@@ -7829,11 +8326,13 @@ class SelectorQuery {
7829
8326
  return this;
7830
8327
  }
7831
8328
  select(selector) {
8329
+ // 小程序里跨自定义组件的后代选择器 '>>>' 在 h5 替换为普通后代选择器 '>'
7832
8330
  if (typeof selector === 'string')
7833
8331
  selector = selector.replace('>>>', '>');
7834
8332
  return new NodesRef(selector, this, true);
7835
8333
  }
7836
8334
  selectAll(selector) {
8335
+ // 小程序里跨自定义组件的后代选择器 '>>>' 在 h5 替换为普通后代选择器 '>'
7837
8336
  if (typeof selector === 'string')
7838
8337
  selector = selector.replace('>>>', '>');
7839
8338
  return new NodesRef(selector, this, false);
@@ -7868,9 +8367,11 @@ const createSelectorQuery = () => {
7868
8367
  };
7869
8368
  const createIntersectionObserver = temporarilyNotSupport('createIntersectionObserver');
7870
8369
 
8370
+ // AliPay
7871
8371
  const getOpenUserInfo = temporarilyNotSupport('getOpenUserInfo');
7872
8372
 
7873
8373
  const setPageInfo = temporarilyNotSupport('setPageInfo');
8374
+ // 百度小程序 AI 相关
7874
8375
  const ocrIdCard = temporarilyNotSupport('ocrIdCard');
7875
8376
  const ocrBankCard = temporarilyNotSupport('ocrBankCard');
7876
8377
  const ocrDrivingLicense = temporarilyNotSupport('ocrDrivingLicense');
@@ -7885,19 +8386,23 @@ const dishClassify = temporarilyNotSupport('dishClassify');
7885
8386
  const logoClassify = temporarilyNotSupport('logoClassify');
7886
8387
  const animalClassify = temporarilyNotSupport('animalClassify');
7887
8388
  const plantClassify = temporarilyNotSupport('plantClassify');
8389
+ // 用户信息
7888
8390
  const getSwanId = temporarilyNotSupport('getSwanId');
8391
+ // 百度收银台支付
7889
8392
  const requestPolymerPayment = temporarilyNotSupport('requestPolymerPayment');
8393
+ // 打开小程序
7890
8394
  const navigateToSmartGameProgram = temporarilyNotSupport('navigateToSmartGameProgram');
7891
8395
  const navigateToSmartProgram = temporarilyNotSupport('navigateToSmartProgram');
7892
8396
  const navigateBackSmartProgram = temporarilyNotSupport('navigateBackSmartProgram');
7893
8397
  const preloadSubPackage = temporarilyNotSupport('preloadSubPackage');
7894
8398
 
7895
- const { Behavior, getEnv, ENV_TYPE, Link: Link$1, interceptors, getInitPxTransform, Current, options, eventCenter, Events, preload, useDidShow, useDidHide, usePullDownRefresh, useReachBottom, usePageScroll, useResize, useShareAppMessage, useTabItemTap, useTitleClick, useOptionMenuClick, usePullIntercept, useShareTimeline, useAddToFavorites, useReady, useRouter } = Taro;
8399
+ const { Behavior, getEnv, ENV_TYPE, Link, interceptors, getInitPxTransform, Current, options, eventCenter, Events, preload } = Taro__default['default'];
7896
8400
  const taro = {
8401
+ // @ts-ignore
7897
8402
  Behavior,
7898
8403
  getEnv,
7899
8404
  ENV_TYPE,
7900
- Link: Link$1,
8405
+ Link,
7901
8406
  interceptors,
7902
8407
  Current,
7903
8408
  getCurrentInstance,
@@ -7913,26 +8418,12 @@ const taro = {
7913
8418
  reLaunch: router.reLaunch,
7914
8419
  redirectTo: router.redirectTo,
7915
8420
  getCurrentPages: router.getCurrentPages,
7916
- switchTab: router.switchTab,
7917
- useDidShow,
7918
- useDidHide,
7919
- usePullDownRefresh,
7920
- useReachBottom,
7921
- usePageScroll,
7922
- useResize,
7923
- useShareAppMessage,
7924
- useTabItemTap,
7925
- useTitleClick,
7926
- useOptionMenuClick,
7927
- usePullIntercept,
7928
- useShareTimeline,
7929
- useAddToFavorites,
7930
- useReady,
7931
- useRouter
8421
+ switchTab: router.switchTab
7932
8422
  };
7933
8423
  const initPxTransform = getInitPxTransform(taro);
7934
8424
  const requirePlugin = permanentlyNotSupport('requirePlugin');
7935
8425
  const pxTransform = function (size) {
8426
+ // @ts-ignore
7936
8427
  const { designWidth } = taro.config;
7937
8428
  return Math.ceil((((parseInt(size, 10) / 40) * 640) / designWidth) * 10000) / 10000 + 'rem';
7938
8429
  };
@@ -7944,6 +8435,7 @@ taro.requirePlugin = requirePlugin;
7944
8435
  taro.getApp = getApp;
7945
8436
  taro.pxTransform = pxTransform;
7946
8437
  taro.initPxTransform = initPxTransform;
8438
+ // @ts-ignore
7947
8439
  taro.canIUseWebp = canIUseWebp;
7948
8440
 
7949
8441
  Object.defineProperty(exports, 'createRouter', {
@@ -7999,7 +8491,7 @@ exports.Current = Current;
7999
8491
  exports.ENV_TYPE = ENV_TYPE;
8000
8492
  exports.EditorContext = EditorContext;
8001
8493
  exports.Events = Events;
8002
- exports.Link = Link$1;
8494
+ exports.Link = Link;
8003
8495
  exports.addCard = addCard;
8004
8496
  exports.addFileToFavorites = addFileToFavorites;
8005
8497
  exports.addInterceptor = addInterceptor;
@@ -8072,7 +8564,7 @@ exports.createVideoContext = createVideoContext;
8072
8564
  exports.createVideoDecoder = createVideoDecoder;
8073
8565
  exports.createWebAudioContext = createWebAudioContext;
8074
8566
  exports.createWorker = createWorker;
8075
- exports.default = taro;
8567
+ exports['default'] = taro;
8076
8568
  exports.disableAlertBeforeUnload = disableAlertBeforeUnload;
8077
8569
  exports.dishClassify = dishClassify;
8078
8570
  exports.downloadFile = downloadFile;
@@ -8388,21 +8880,6 @@ exports.updateShareMenu = updateShareMenu;
8388
8880
  exports.updateVoIPChatMuteConfig = updateVoIPChatMuteConfig;
8389
8881
  exports.updateWeChatApp = updateWeChatApp;
8390
8882
  exports.uploadFile = uploadFile;
8391
- exports.useAddToFavorites = useAddToFavorites;
8392
- exports.useDidHide = useDidHide;
8393
- exports.useDidShow = useDidShow;
8394
- exports.useOptionMenuClick = useOptionMenuClick;
8395
- exports.usePageScroll = usePageScroll;
8396
- exports.usePullDownRefresh = usePullDownRefresh;
8397
- exports.usePullIntercept = usePullIntercept;
8398
- exports.useReachBottom = useReachBottom;
8399
- exports.useReady = useReady;
8400
- exports.useResize = useResize;
8401
- exports.useRouter = useRouter;
8402
- exports.useShareAppMessage = useShareAppMessage;
8403
- exports.useShareTimeline = useShareTimeline;
8404
- exports.useTabItemTap = useTabItemTap;
8405
- exports.useTitleClick = useTitleClick;
8406
8883
  exports.vibrateLong = vibrateLong;
8407
8884
  exports.vibrateShort = vibrateShort;
8408
8885
  exports.writeBLECharacteristicValue = writeBLECharacteristicValue;