@tarojs/taro 3.8.0-canary.0 → 4.0.0-beta.0

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 (73) hide show
  1. package/html.css +9 -0
  2. package/package.json +11 -4
  3. package/types/api/ad/index.d.ts +6 -18
  4. package/types/api/ai/inference.d.ts +4 -8
  5. package/types/api/ai/visionkit.d.ts +625 -54
  6. package/types/api/base/performance.d.ts +5 -5
  7. package/types/api/base/system.d.ts +2 -2
  8. package/types/api/base/weapp/app-event.d.ts +4 -4
  9. package/types/api/canvas/index.d.ts +67 -54
  10. package/types/api/data-analysis/index.d.ts +51 -1
  11. package/types/api/device/accelerometer.d.ts +8 -6
  12. package/types/api/device/accessibility.d.ts +1 -1
  13. package/types/api/device/battery.d.ts +3 -3
  14. package/types/api/device/bluetooth-ble.d.ts +40 -17
  15. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  16. package/types/api/device/bluetooth.d.ts +37 -13
  17. package/types/api/device/calendar.d.ts +11 -1
  18. package/types/api/device/clipboard.d.ts +17 -17
  19. package/types/api/device/compass.d.ts +5 -5
  20. package/types/api/device/gyroscope.d.ts +4 -4
  21. package/types/api/device/iBeacon.d.ts +10 -8
  22. package/types/api/device/keyboard.d.ts +7 -5
  23. package/types/api/device/memory.d.ts +3 -4
  24. package/types/api/device/motion.d.ts +8 -6
  25. package/types/api/device/network.d.ts +12 -6
  26. package/types/api/device/nfc.d.ts +13 -13
  27. package/types/api/device/phone.d.ts +1 -1
  28. package/types/api/device/scan.d.ts +5 -3
  29. package/types/api/device/screen.d.ts +28 -12
  30. package/types/api/device/sms.d.ts +1 -1
  31. package/types/api/device/vibrate.d.ts +5 -5
  32. package/types/api/device/wifi.d.ts +25 -13
  33. package/types/api/files/index.d.ts +71 -41
  34. package/types/api/location/index.d.ts +166 -18
  35. package/types/api/media/audio.d.ts +50 -30
  36. package/types/api/media/camera.d.ts +6 -3
  37. package/types/api/media/image.d.ts +1 -1
  38. package/types/api/navigate/index.d.ts +2 -0
  39. package/types/api/network/download.d.ts +2 -10
  40. package/types/api/network/request.d.ts +1 -1
  41. package/types/api/network/upload.d.ts +2 -10
  42. package/types/api/open-api/device-voip.d.ts +2 -2
  43. package/types/api/open-api/login.d.ts +1 -1
  44. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  45. package/types/api/open-api/privacy.d.ts +99 -0
  46. package/types/api/route/index.d.ts +8 -5
  47. package/types/api/skyline/index.d.ts +59 -0
  48. package/types/api/storage/background-fetch.d.ts +63 -11
  49. package/types/api/storage/cache-manager.d.ts +61 -10
  50. package/types/api/storage/index.d.ts +125 -10
  51. package/types/api/taro.extend.d.ts +9 -3
  52. package/types/api/ui/animation.d.ts +1 -1
  53. package/types/api/ui/fonts.d.ts +4 -3
  54. package/types/api/ui/interaction.d.ts +4 -4
  55. package/types/api/ui/navigation-bar.d.ts +5 -5
  56. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  57. package/types/api/ui/scroll.d.ts +1 -1
  58. package/types/api/ui/tab-bar.d.ts +7 -7
  59. package/types/api/wxml/index.d.ts +4 -4
  60. package/types/compile/compiler.d.ts +7 -4
  61. package/types/compile/config/h5.d.ts +23 -10
  62. package/types/compile/config/harmony.d.ts +77 -0
  63. package/types/compile/config/index.d.ts +1 -0
  64. package/types/compile/config/mini.d.ts +58 -30
  65. package/types/compile/config/plugin.d.ts +34 -0
  66. package/types/compile/config/project.d.ts +26 -13
  67. package/types/compile/config/util.d.ts +22 -8
  68. package/types/compile/viteCompilerContext.d.ts +149 -0
  69. package/types/global.d.ts +1 -0
  70. package/types/index.d.ts +2 -0
  71. package/types/taro.api.d.ts +3 -0
  72. package/types/taro.component.d.ts +2 -1
  73. package/types/taro.config.d.ts +41 -4
@@ -7,16 +7,23 @@ declare module '../../index' {
7
7
  latitude: number
8
8
  /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
9
9
  longitude: number
10
+ /** 缩放比例
11
+ * @weapp 范围 5~18,默认值18
12
+ * @alipay 范围 3~19,默认值15
13
+ */
14
+ scale?: number
15
+ /** 位置名 */
16
+ name?: string
10
17
  /** 地址的详细说明 */
11
18
  address?: string
19
+ /** 定义在拉起的地图 App 面板中需要被屏蔽的地图类 App
20
+ * @supported swan
21
+ */
22
+ ignoredApps?: Array<any>
12
23
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
13
24
  complete?: (res: TaroGeneral.CallbackResult) => void
14
25
  /** 接口调用失败的回调函数 */
15
26
  fail?: (res: TaroGeneral.CallbackResult) => void
16
- /** 位置名 */
17
- name?: string
18
- /** 缩放比例,范围5~18 */
19
- scale?: number
20
27
  /** 接口调用成功的回调函数 */
21
28
  success?: (res: TaroGeneral.CallbackResult) => void
22
29
  }
@@ -24,20 +31,32 @@ declare module '../../index' {
24
31
 
25
32
  namespace getLocation {
26
33
  interface Option {
27
- /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
28
- altitude?: string
34
+ /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
35
+ * @default false
36
+ */
37
+ altitude?: boolean
29
38
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
30
39
  complete?: (res: TaroGeneral.CallbackResult) => void
31
40
  /** 接口调用失败的回调函数 */
32
41
  fail?: (res: TaroGeneral.CallbackResult) => void
33
42
  /** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
34
43
  highAccuracyExpireTime?: number
35
- /** 开启高精度定位 */
44
+ /** 开启高精度定位
45
+ * @default false
46
+ */
36
47
  isHighAccuracy?: boolean
37
48
  /** 接口调用成功的回调函数 */
38
49
  success?: (result: SuccessCallbackResult) => void
39
- /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
50
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标
51
+ * @default "wgs84"
52
+ */
40
53
  type?: string
54
+ /** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
55
+ * 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
56
+ * @supported swan
57
+ * @default false
58
+ */
59
+ needFullAccuracy?: boolean
41
60
  }
42
61
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
43
62
  /** 位置的精确度 */
@@ -54,6 +73,42 @@ declare module '../../index' {
54
73
  speed: number
55
74
  /** 垂直精度,单位 m(Android 无法获取,返回 0) */
56
75
  verticalAccuracy: number
76
+ /** 城市名称
77
+ * @supported swan
78
+ */
79
+ street?: string
80
+ /** 国家代码
81
+ * @supported swan
82
+ */
83
+ cityCode?: string
84
+ /** 城市名称
85
+ * @supported swan, tt
86
+ */
87
+ city?: string
88
+ /** 国家
89
+ * @supported swan
90
+ */
91
+ country?: string
92
+ /** 国家代码
93
+ * @supported swan
94
+ */
95
+ countryCode?: string
96
+ /** 省份
97
+ * @supported swan
98
+ */
99
+ province?: string
100
+ /** 街道号码
101
+ * @supported swan
102
+ */
103
+ streetNumber?: string
104
+ /** 区
105
+ * @supported swan
106
+ */
107
+ district?: string
108
+ /** 是不是精确定位信息
109
+ * @supported swan
110
+ */
111
+ isFullAccuracy?: boolean
57
112
  /** 调用结果 */
58
113
  errMsg: string
59
114
  }
@@ -97,6 +152,12 @@ declare module '../../index' {
97
152
  * @see https://lbs.qq.com/webApi/component/componentGuide/componentPicker
98
153
  */
99
154
  mapOpts?: Record<string, unknown>
155
+ /** 页面显示标题
156
+ * @supported alipay
157
+ * @alipay 安卓默认值为 位置,iOS、IDE 默认值为 你在哪里?
158
+ * @see https://opendocs.alipay.com/mini/api/location?pathHash=951b46a1
159
+ */
160
+ title?: string
100
161
  /** 接口调用成功的回调函数 */
101
162
  success?: (result: SuccessCallbackResult) => void
102
163
  /** 接口调用失败的回调函数 */
@@ -114,6 +175,30 @@ declare module '../../index' {
114
175
  longitude: number
115
176
  /** 位置名称 */
116
177
  name: string
178
+ /** 区县代码
179
+ * @supported alipay
180
+ */
181
+ adCode?: number
182
+ /** 区县名称
183
+ * @supported alipay
184
+ */
185
+ adName?: string
186
+ /** 城市代码
187
+ * @supported alipay
188
+ */
189
+ cityCode?: string
190
+ /** 城市名称
191
+ * @supported alipay
192
+ */
193
+ cityName?: string
194
+ /** 省份代码
195
+ * @supported alipay
196
+ */
197
+ provinceCode?: number
198
+ /** 省份名称
199
+ * @supported alipay
200
+ */
201
+ provinceName?: string
117
202
  /** 调用结果 */
118
203
  errMsg: string
119
204
  }
@@ -132,6 +217,10 @@ declare module '../../index' {
132
217
 
133
218
  namespace startLocationUpdateBackground {
134
219
  interface Option {
220
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
221
+ * @default "gcj02"
222
+ */
223
+ type?: string
135
224
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
136
225
  complete?: (res: TaroGeneral.CallbackResult) => void
137
226
  /** 接口调用失败的回调函数 */
@@ -143,6 +232,16 @@ declare module '../../index' {
143
232
 
144
233
  namespace startLocationUpdate {
145
234
  interface Option {
235
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
236
+ * @default "gcj02"
237
+ */
238
+ type?: string
239
+ /** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
240
+ * 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
241
+ * @supported swan
242
+ * @default false
243
+ */
244
+ needFullAccuracy?: boolean
146
245
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
147
246
  complete?: (res: TaroGeneral.CallbackResult) => void
148
247
  /** 接口调用失败的回调函数 */
@@ -161,6 +260,11 @@ declare module '../../index' {
161
260
  interface CallbackResult {
162
261
  /** 错误码 */
163
262
  errCode: number
263
+ /** 错误信息
264
+ * @supported tt
265
+ * @tt 最低支持版本 2.48.0
266
+ */
267
+ errMsg?: string
164
268
  }
165
269
  }
166
270
 
@@ -185,13 +289,50 @@ declare module '../../index' {
185
289
  speed: number
186
290
  /** 垂直精度,单位 m(Android 无法获取,返回 0) */
187
291
  verticalAccuracy: number
292
+ /** 街道名称
293
+ * @supported swan
294
+ */
295
+ street?: string
296
+ /** 城市编码
297
+ * @supported swan
298
+ */
299
+ cityCode?: string
300
+ /** 城市名称
301
+ * @supported swan, tt
302
+ * @tt iOS 不支持
303
+ */
304
+ city?: string
305
+ /** 国家
306
+ * @supported swan
307
+ */
308
+ country?: string
309
+ /** 国家代码
310
+ * @supported swan
311
+ */
312
+ countryCode?: string
313
+ /** 省份
314
+ * @supported swan
315
+ */
316
+ province?: string
317
+ /** 街道号码
318
+ * @supported swan
319
+ */
320
+ streetNumber?: string
321
+ /** 区
322
+ * @supported swan
323
+ */
324
+ district?: string
325
+ /** 是不是精确定位信息
326
+ * @supported swan
327
+ */
328
+ isFullAccuracy?: boolean
188
329
  }
189
330
  }
190
331
 
191
332
  namespace getFuzzyLocation {
192
333
  interface Option {
193
334
  /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
194
- type?: 'wgs84' | 'gcj02'
335
+ type?: keyof Type
195
336
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
196
337
  complete?: (res: TaroGeneral.CallbackResult) => void
197
338
  /** 接口调用失败的回调函数 */
@@ -200,6 +341,13 @@ declare module '../../index' {
200
341
  success?: (result: SuccessCallbackResult) => void
201
342
  }
202
343
 
344
+ interface Type {
345
+ /** 返回 gps 坐标 */
346
+ wgs84
347
+ /** 返回 gcj02 坐标*/
348
+ gcj02
349
+ }
350
+
203
351
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
204
352
  /** 纬度,范围为 -90~90,负数表示南纬 */
205
353
  latitude: number
@@ -210,7 +358,7 @@ declare module '../../index' {
210
358
 
211
359
  interface TaroStatic {
212
360
  /** 关闭监听实时位置变化,前后台都停止消息接收
213
- * @supported weapp, rn, tt
361
+ * @supported weapp, swan, tt, rn
214
362
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html
215
363
  */
216
364
  stopLocationUpdate(option?: stopLocationUpdate.Option): void
@@ -232,13 +380,13 @@ declare module '../../index' {
232
380
  *
233
381
  * **注意**
234
382
  * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
235
- * @supported weapp, rn, tt
383
+ * @supported weapp, swan, tt, rn
236
384
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html
237
385
  */
238
386
  startLocationUpdate(option?: startLocationUpdate.Option): void
239
387
 
240
388
  /** 使用微信内置地图查看位置
241
- * @supported weapp, h5, tt
389
+ * @supported weapp, alipay, swan, jd, tt, h5
242
390
  * @example
243
391
  * ```tsx
244
392
  * Taro.getLocation({
@@ -268,7 +416,7 @@ declare module '../../index' {
268
416
  ): void
269
417
 
270
418
  /** 监听实时地理位置变化事件,需结合 Taro.startLocationUpdateBackground、Taro.startLocationUpdate 使用。
271
- * @supported weapp, rn, tt
419
+ * @supported weapp, swan, tt, rn
272
420
  * @example
273
421
  * ```tsx
274
422
  * const _locationChangeFn = function (res) {
@@ -290,16 +438,16 @@ declare module '../../index' {
290
438
  */
291
439
  offLocationChangeError(
292
440
  /** 监听持续定位接口返回失败时触发的回调函数 */
293
- callback: onLocationChangeError.Callback,
441
+ callback?: onLocationChangeError.Callback,
294
442
  ): void
295
443
 
296
444
  /** 取消监听实时地理位置变化事件
297
- * @supported weapp, rn, tt
445
+ * @supported weapp, swan, tt, rn
298
446
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html
299
447
  */
300
448
  offLocationChange(
301
449
  /** 实时地理位置变化事件的回调函数 */
302
- callback: (res: TaroGeneral.CallbackResult) => void,
450
+ callback?: onLocationChange.Callback,
303
451
  ): void
304
452
 
305
453
  /** 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。
@@ -307,7 +455,7 @@ declare module '../../index' {
307
455
  * **注意**
308
456
  * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
309
457
  * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
310
- * @supported weapp, rn, tt
458
+ * @supported weapp, swan, jd, qq, tt, rn
311
459
  * @example
312
460
  * ```tsx
313
461
  * Taro.getLocation({
@@ -333,7 +481,7 @@ declare module '../../index' {
333
481
  /** 打开地图选择位置。
334
482
  *
335
483
  * `chooseLocation` api功能是依赖于腾讯位置服务,所以需要使用 api 密钥。如果您没有,可以前往腾讯位置服务[开发者控制台](https://lbs.qq.com/console/mykey.html?console=mykey)进行申请。
336
- * @supported weapp, h5, tt
484
+ * @supported weapp, alipay, swan, jd, tt, h5
337
485
  * @example
338
486
  * ```tsx
339
487
  * // config/index.js
@@ -292,83 +292,83 @@ declare module '../../index' {
292
292
  /** 音频进入可以播放状态,但不保证后面可以流畅播放
293
293
  * @supported weapp, h5, rn
294
294
  */
295
- onCanplay(callback?: () => void): void
295
+ onCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
296
296
  /** 音频播放事件
297
297
  * @supported weapp, h5, rn
298
298
  */
299
- onPlay(callback?: () => void): void
299
+ onPlay(callback?: InnerAudioContext.OnPlayCallback): void
300
300
  /** 音频暂停事件
301
301
  * @supported weapp, h5, rn
302
302
  */
303
- onPause(callback?: () => void): void
303
+ onPause(callback?: InnerAudioContext.OnPauseCallback): void
304
304
  /** 音频停止事件
305
305
  * @supported weapp, h5, rn
306
306
  */
307
- onStop(callback?: () => void): void
307
+ onStop(callback?: InnerAudioContext.OnStopCallback): void
308
308
  /** 音频自然播放结束事件
309
309
  * @supported weapp, h5, rn
310
310
  */
311
- onEnded(callback?: () => void): void
311
+ onEnded(callback?: InnerAudioContext.OnEndedCallback): void
312
312
  /** 音频播放进度更新事件
313
313
  * @supported weapp, h5, rn
314
314
  */
315
- onTimeUpdate(callback?: () => void): void
315
+ onTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
316
316
  /** 音频播放错误事件
317
317
  * @supported weapp, h5, rn
318
318
  */
319
- onError(callback?: (res: InnerAudioContext.onErrorDetail) => void): void
319
+ onError(callback?: InnerAudioContext.OnErrorCallback): void
320
320
  /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
321
321
  * @supported weapp, h5, rn
322
322
  */
323
- onWaiting(callback?: () => void): void
323
+ onWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
324
324
  /** 音频进行 seek 操作事件
325
325
  * @supported weapp, h5, rn
326
326
  */
327
- onSeeking(callback?: () => void): void
327
+ onSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
328
328
  /** 音频完成 seek 操作事件
329
329
  * @supported weapp, h5, rn
330
330
  */
331
- onSeeked(callback?: () => void): void
332
- /** 取消监听 onCanplay 事件
331
+ onSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
332
+ /** 取消监听 canplay 事件
333
333
  * @supported weapp, h5, rn
334
334
  */
335
- offCanplay(callback?: () => void): void
336
- /** 取消监听 onPlay 事件
335
+ offCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
336
+ /** 取消监听 play 事件
337
337
  * @supported weapp, h5, rn
338
338
  */
339
- offPlay(callback?: () => void): void
340
- /** 取消监听 onPause 事件
339
+ offPlay(callback?: InnerAudioContext.OnPlayCallback): void
340
+ /** 取消监听 pause 事件
341
341
  * @supported weapp, h5, rn
342
342
  */
343
- offPause(callback?: () => void): void
344
- /** 取消监听 onStop 事件
343
+ offPause(callback?: InnerAudioContext.OnPauseCallback): void
344
+ /** 取消监听 stop 事件
345
345
  * @supported weapp, h5, rn
346
346
  */
347
- offStop(callback?: () => void): void
348
- /** 取消监听 onEnded 事件
347
+ offStop(callback?: InnerAudioContext.OnStopCallback): void
348
+ /** 取消监听 ended 事件
349
349
  * @supported weapp, h5, rn
350
350
  */
351
- offEnded(callback?: () => void): void
352
- /** 取消监听 onTimeUpdate 事件
351
+ offEnded(callback?: InnerAudioContext.OnEndedCallback): void
352
+ /** 取消监听 timeUpdate 事件
353
353
  * @supported weapp, h5, rn
354
354
  */
355
- offTimeUpdate(callback?: () => void): void
356
- /** 取消监听 onError 事件
355
+ offTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
356
+ /** 取消监听 error 事件
357
357
  * @supported weapp, h5, rn
358
358
  */
359
- offError(callback?: () => void): void
360
- /** 取消监听 onWaiting 事件
359
+ offError(callback?: InnerAudioContext.OnErrorCallback): void
360
+ /** 取消监听 waiting 事件
361
361
  * @supported weapp, h5, rn
362
362
  */
363
- offWaiting(callback?: () => void): void
364
- /** 取消监听 onSeeking 事件
363
+ offWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
364
+ /** 取消监听 seeking 事件
365
365
  * @supported weapp, h5, rn
366
366
  */
367
- offSeeking(callback?: () => void): void
368
- /** 取消监听 onSeeked 事件
367
+ offSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
368
+ /** 取消监听 seeked 事件
369
369
  * @supported weapp, h5, rn
370
370
  */
371
- offSeeked(callback?: () => void): void
371
+ offSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
372
372
  }
373
373
 
374
374
  namespace InnerAudioContext {
@@ -391,6 +391,26 @@ declare module '../../index' {
391
391
  /** 未知错误 */
392
392
  '-1'
393
393
  }
394
+ /** 音频进入可以播放状态事件的回调函数 */
395
+ type OnCanplayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
396
+ /** 音频播放事件的回调函数 */
397
+ type OnPlayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
398
+ /** 音频暂停事件的回调函数 */
399
+ type OnPauseCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
400
+ /** 音频停止事件的回调函数 */
401
+ type OnStopCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
402
+ /** 音频自然播放结束事件的回调函数 */
403
+ type OnEndedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
404
+ /** 音频播放进度更新事件的回调函数 */
405
+ type OnTimeUpdateCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
406
+ /** 音频播放错误事件的回调函数 */
407
+ type OnErrorCallback = (res: onErrorDetail) => void
408
+ /** 音频加载中事件的回调函数 */
409
+ type OnWaitingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
410
+ /** 音频进行 seek 操作事件的回调函数 */
411
+ type OnSeekingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
412
+ /** 音频完成 seek 操作事件的回调函数 */
413
+ type OnSeekedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
394
414
  }
395
415
 
396
416
  /** MediaAudioPlayer 实例,可通过 [Taro.createMediaAudioPlayer](./createMediaAudioPlayer) 接口获取实例。
@@ -90,15 +90,15 @@ declare module '../../index' {
90
90
  * @supported alipay
91
91
  */
92
92
  height: string
93
- /** 视频文件的宽度。
93
+ /** 视频文件的宽度。
94
94
  * @supported alipay
95
95
  */
96
96
  width: string
97
- /** 视频文件的尺寸。
97
+ /** 视频文件的尺寸。
98
98
  * @supported alipay
99
99
  */
100
100
  size: string
101
- /** 录制的持续时间。
101
+ /** 录制的持续时间。
102
102
  * @supported alipay
103
103
  */
104
104
  duration: string
@@ -152,6 +152,8 @@ declare module '../../index' {
152
152
  normal
153
153
  /** 低质量 */
154
154
  low
155
+ /** 原图 */
156
+ original
155
157
  }
156
158
  }
157
159
 
@@ -192,6 +194,7 @@ declare module '../../index' {
192
194
 
193
195
  interface TaroStatic {
194
196
  /** 创建 camera 上下文 CameraContext 对象。
197
+ * @alipay 支付宝小程序需指定 camera 组件中的 id 属性
195
198
  * @supported weapp, rn, tt, alipay
196
199
  * @example
197
200
  * ```tsx
@@ -361,7 +361,7 @@ declare module '../../index' {
361
361
  previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
362
362
 
363
363
  /** 获取图片信息。网络图片需先配置download域名才能生效。
364
- * @supported weapp, alipay, swan, tt, h5, rn
364
+ * @supported weapp, alipay, swan, tt, h5, rn, harmony
365
365
  * @example
366
366
  * ```tsx
367
367
  * Taro.getImageInfo({
@@ -17,6 +17,8 @@ declare module '../../index' {
17
17
  verify?: keyof Verify
18
18
  /** 不 reLaunch 目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query、apiCategory与上次启动相同。默认值为 false 。 */
19
19
  noRelaunchIfPathUnchanged?: boolean
20
+ /** 打开的小程序是否支持全屏 */
21
+ allowFullScreen?: boolean
20
22
  /** 接口调用成功的回调函数 */
21
23
  success?: (res: TaroGeneral.CallbackResult) => void
22
24
  /** 接口调用失败的回调函数 */
@@ -57,14 +57,6 @@ declare module '../../index' {
57
57
  }
58
58
 
59
59
  namespace DownloadTask {
60
- /** HTTP Response Header 事件的回调函数 */
61
- type OffHeadersReceivedCallback = (
62
- res: TaroGeneral.CallbackResult,
63
- ) => void
64
- /** 下载进度变化事件的回调函数 */
65
- type OffProgressUpdateCallback = (
66
- res: TaroGeneral.CallbackResult,
67
- ) => void
68
60
  /** HTTP Response Header 事件的回调函数 */
69
61
  type OnHeadersReceivedCallback = (
70
62
  result: OnHeadersReceivedCallbackResult,
@@ -135,7 +127,7 @@ declare module '../../index' {
135
127
  */
136
128
  offProgressUpdate(
137
129
  /** 下载进度变化事件的回调函数 */
138
- callback: DownloadTask.OffProgressUpdateCallback,
130
+ callback: DownloadTask.OnProgressUpdateCallback,
139
131
  ): void
140
132
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
141
133
  * @supported weapp, h5
@@ -151,7 +143,7 @@ declare module '../../index' {
151
143
  */
152
144
  offHeadersReceived(
153
145
  /** HTTP Response Header 事件的回调函数 */
154
- callback: DownloadTask.OffHeadersReceivedCallback,
146
+ callback: DownloadTask.OnHeadersReceivedCallback,
155
147
  ): void
156
148
  }
157
149
 
@@ -400,7 +400,7 @@ declare module '../../index' {
400
400
  * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
401
401
  * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
402
402
  * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
403
- * @supported weapp, h5, rn, alipay, swan, tt, qq
403
+ * @supported weapp, h5, rn, alipay, swan, tt, qq, harmony
404
404
  * @example
405
405
  * ```tsx
406
406
  * Taro.request({
@@ -56,14 +56,6 @@ declare module '../../index' {
56
56
  }
57
57
 
58
58
  namespace UploadTask {
59
- /** HTTP Response Header 事件的回调函数 */
60
- type OffHeadersReceivedCallback = (
61
- res: TaroGeneral.CallbackResult,
62
- ) => void
63
- /** 上传进度变化事件的回调函数 */
64
- type OffProgressUpdateCallback = (
65
- res: TaroGeneral.CallbackResult,
66
- ) => void
67
59
  /** HTTP Response Header 事件的回调函数 */
68
60
  type OnHeadersReceivedCallback = (
69
61
  result: OnHeadersReceivedCallbackResult,
@@ -138,7 +130,7 @@ declare module '../../index' {
138
130
  */
139
131
  offProgressUpdate(
140
132
  /** 上传进度变化事件的回调函数 */
141
- callback: UploadTask.OffProgressUpdateCallback,
133
+ callback: UploadTask.OnProgressUpdateCallback,
142
134
  ): void
143
135
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
144
136
  * @supported weapp, h5
@@ -154,7 +146,7 @@ declare module '../../index' {
154
146
  */
155
147
  offHeadersReceived(
156
148
  /** HTTP Response Header 事件的回调函数 */
157
- callback: UploadTask.OffHeadersReceivedCallback,
149
+ callback: UploadTask.OnHeadersReceivedCallback,
158
150
  ): void
159
151
  }
160
152
 
@@ -20,7 +20,7 @@ declare module '../../index' {
20
20
  /** 接口调用失败的回调函数 */
21
21
  fail?: (res: TaroGeneral.CallbackResult) => void
22
22
  /** 接口调用成功的回调函数 */
23
- success?: (result: SuccessCallbackResult) => void
23
+ success?: (result: TaroGeneral.CallbackResult) => void
24
24
  }
25
25
  }
26
26
 
@@ -60,4 +60,4 @@ declare module '../../index' {
60
60
  */
61
61
  getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
62
62
  }
63
- }
63
+ }
@@ -81,7 +81,7 @@ declare module '../../index' {
81
81
  *
82
82
  * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
83
83
  *
84
- * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
84
+ * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
85
85
  * @supported weapp
86
86
  * @example
87
87
  * ```tsx
@@ -8,7 +8,7 @@ declare module '../../index' {
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用成功的回调函数 */
11
- success?: (res: TaroGeneral.CallbackResult) => void
11
+ success?: (res: SuccessCallbackResult) => void
12
12
  }
13
13
 
14
14
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
@@ -23,6 +23,6 @@ declare module '../../index' {
23
23
  * @supported weapp
24
24
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
25
25
  */
26
- checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
26
+ checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
27
27
  }
28
28
  }