@tarojs/taro 3.8.0-canary.0 → 4.0.0-alpha.2

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 (101) hide show
  1. package/html.css +9 -0
  2. package/package.json +16 -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/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +1 -1
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +6 -6
  11. package/types/api/base/weapp/app-event.d.ts +10 -10
  12. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  13. package/types/api/canvas/index.d.ts +389 -72
  14. package/types/api/data-analysis/index.d.ts +51 -1
  15. package/types/api/device/accelerometer.d.ts +8 -6
  16. package/types/api/device/accessibility.d.ts +1 -1
  17. package/types/api/device/battery.d.ts +3 -3
  18. package/types/api/device/bluetooth-ble.d.ts +40 -17
  19. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  20. package/types/api/device/bluetooth.d.ts +37 -13
  21. package/types/api/device/calendar.d.ts +11 -1
  22. package/types/api/device/clipboard.d.ts +17 -17
  23. package/types/api/device/compass.d.ts +5 -5
  24. package/types/api/device/gyroscope.d.ts +4 -4
  25. package/types/api/device/iBeacon.d.ts +10 -8
  26. package/types/api/device/keyboard.d.ts +7 -5
  27. package/types/api/device/memory.d.ts +3 -4
  28. package/types/api/device/motion.d.ts +8 -6
  29. package/types/api/device/network.d.ts +12 -6
  30. package/types/api/device/nfc.d.ts +13 -13
  31. package/types/api/device/phone.d.ts +1 -1
  32. package/types/api/device/scan.d.ts +5 -3
  33. package/types/api/device/screen.d.ts +28 -12
  34. package/types/api/device/sms.d.ts +1 -1
  35. package/types/api/device/vibrate.d.ts +5 -5
  36. package/types/api/device/wifi.d.ts +25 -13
  37. package/types/api/files/index.d.ts +73 -43
  38. package/types/api/framework/index.d.ts +2 -2
  39. package/types/api/location/index.d.ts +167 -19
  40. package/types/api/media/audio.d.ts +71 -42
  41. package/types/api/media/background-audio.d.ts +1 -1
  42. package/types/api/media/camera.d.ts +6 -3
  43. package/types/api/media/image.d.ts +5 -5
  44. package/types/api/media/video.d.ts +11 -11
  45. package/types/api/navigate/index.d.ts +3 -1
  46. package/types/api/network/download.d.ts +7 -15
  47. package/types/api/network/request.d.ts +7 -7
  48. package/types/api/network/upload.d.ts +9 -17
  49. package/types/api/network/websocket.d.ts +8 -8
  50. package/types/api/open-api/account.d.ts +1 -1
  51. package/types/api/open-api/address.d.ts +13 -5
  52. package/types/api/open-api/authorize.d.ts +1 -1
  53. package/types/api/open-api/channels.d.ts +16 -0
  54. package/types/api/open-api/device-voip.d.ts +42 -2
  55. package/types/api/open-api/invoice.d.ts +1 -1
  56. package/types/api/open-api/login.d.ts +16 -3
  57. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  58. package/types/api/open-api/privacy.d.ts +107 -0
  59. package/types/api/open-api/settings.d.ts +3 -2
  60. package/types/api/open-api/sticker.d.ts +83 -0
  61. package/types/api/open-api/subscribe-message.d.ts +148 -6
  62. package/types/api/open-api/user-info.d.ts +6 -1
  63. package/types/api/qq/index.d.ts +306 -1
  64. package/types/api/route/index.d.ts +8 -5
  65. package/types/api/skyline/index.d.ts +59 -0
  66. package/types/api/storage/background-fetch.d.ts +63 -11
  67. package/types/api/storage/cache-manager.d.ts +61 -10
  68. package/types/api/storage/index.d.ts +125 -10
  69. package/types/api/swan/bookshelf.d.ts +307 -0
  70. package/types/api/swan/download-package.d.ts +80 -0
  71. package/types/api/swan/index.d.ts +151 -0
  72. package/types/api/swan/pay.d.ts +139 -0
  73. package/types/api/taro.extend.d.ts +15 -6
  74. package/types/api/taro.hooks.d.ts +9 -9
  75. package/types/api/ui/animation.d.ts +32 -32
  76. package/types/api/ui/custom-component.d.ts +1 -1
  77. package/types/api/ui/fonts.d.ts +4 -3
  78. package/types/api/ui/interaction.d.ts +6 -6
  79. package/types/api/ui/menu.d.ts +1 -1
  80. package/types/api/ui/navigation-bar.d.ts +5 -5
  81. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  82. package/types/api/ui/scroll.d.ts +1 -1
  83. package/types/api/ui/tab-bar.d.ts +8 -8
  84. package/types/api/ui/window.d.ts +2 -2
  85. package/types/api/wxml/index.d.ts +19 -19
  86. package/types/compile/compiler.d.ts +9 -4
  87. package/types/compile/config/h5.d.ts +23 -10
  88. package/types/compile/config/harmony.d.ts +82 -0
  89. package/types/compile/config/index.d.ts +1 -0
  90. package/types/compile/config/mini.d.ts +58 -30
  91. package/types/compile/config/plugin.d.ts +34 -0
  92. package/types/compile/config/project.d.ts +26 -13
  93. package/types/compile/config/util.d.ts +22 -8
  94. package/types/compile/viteCompilerContext.d.ts +155 -0
  95. package/types/global.d.ts +3 -1
  96. package/types/index.d.ts +92 -44
  97. package/types/taro.api.d.ts +24 -13
  98. package/types/taro.component.d.ts +2 -1
  99. package/types/taro.config.d.ts +47 -6
  100. package/types/taro.lifecycle.d.ts +3 -0
  101. package/types/taro.runtime.d.ts +9 -0
@@ -32,13 +32,26 @@ declare module '../../index' {
32
32
  interval?: number
33
33
  /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
34
34
  services?: string[]
35
+ /** 扫描模式,越高扫描越快,也越耗电。仅安卓微信客户端 7.0.12 及以上支持。 */
36
+ powerLevel?: keyof PowerLevel
35
37
  /** 接口调用成功的回调函数 */
36
38
  success?: (res: TaroGeneral.BluetoothError) => void
37
39
  }
40
+
41
+ interface PowerLevel {
42
+ /** 低 */
43
+ low,
44
+ /** 中 */
45
+ medium,
46
+ /** 高 */
47
+ high
48
+ }
38
49
  }
39
50
 
40
51
  namespace openBluetoothAdapter {
41
52
  interface Option {
53
+ /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。 */
54
+ mode?: keyof Mode;
42
55
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
43
56
  complete?: (res: TaroGeneral.BluetoothError) => void
44
57
  /** 接口调用失败的回调函数 */
@@ -47,6 +60,13 @@ declare module '../../index' {
47
60
  success?: (res: TaroGeneral.BluetoothError) => void
48
61
  }
49
62
 
63
+ interface Mode {
64
+ /** 主机模式 */
65
+ central
66
+ /** 从机(外围设备)模式 */
67
+ peripheral
68
+ }
69
+
50
70
  /** object.fail 回调函数返回的 state 参数(仅 iOS) */
51
71
  interface state {
52
72
  /** 未知 */
@@ -73,7 +93,7 @@ declare module '../../index' {
73
93
  }
74
94
  /** 新搜索到的设备 */
75
95
  interface CallbackResultBlueToothDevice {
76
- /** 当前蓝牙设备的信号强度 */
96
+ /** 当前蓝牙设备的信号强度,单位 dBm */
77
97
  RSSI: number
78
98
  /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
79
99
  advertisData: ArrayBuffer
@@ -87,6 +107,8 @@ declare module '../../index' {
87
107
  name: string
88
108
  /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
89
109
  serviceData: TaroGeneral.IAnyObject
110
+ /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
111
+ connectable?: boolean
90
112
  }
91
113
  }
92
114
 
@@ -193,6 +215,8 @@ declare module '../../index' {
193
215
  name: string
194
216
  /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
195
217
  serviceData: TaroGeneral.IAnyObject
218
+ /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
219
+ connectable?: boolean
196
220
  }
197
221
  }
198
222
 
@@ -229,7 +253,7 @@ declare module '../../index' {
229
253
 
230
254
  interface TaroStatic {
231
255
  /** 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
232
- * @supported weapp
256
+ * @supported weapp, alipay, jd
233
257
  * @example
234
258
  * ```tsx
235
259
  * Taro.stopBluetoothDevicesDiscovery({
@@ -245,7 +269,7 @@ declare module '../../index' {
245
269
  ): Promise<stopBluetoothDevicesDiscovery.Promised>
246
270
 
247
271
  /** 开始搜寻附近的蓝牙外围设备。**此操作比较耗费系统资源,请在搜索并连接到设备后调用 Taro.stopBluetoothDevicesDiscovery 方法停止搜索。**
248
- * @supported weapp
272
+ * @supported weapp, alipay, jd
249
273
  * @example
250
274
  * ```tsx
251
275
  * // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
@@ -267,7 +291,7 @@ declare module '../../index' {
267
291
  * **注意**
268
292
  * - 其他蓝牙相关 API 必须在 Taro.openBluetoothAdapter 调用之后使用。否则 API 会返回错误(errCode=10000)。
269
293
  * - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 Taro.openBluetoothAdapter 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
270
- * @supported weapp
294
+ * @supported weapp, alipay, jd
271
295
  * @example
272
296
  * ```tsx
273
297
  * Taro.openBluetoothAdapter({
@@ -285,7 +309,7 @@ declare module '../../index' {
285
309
  * **注意**
286
310
  * - 若在 Taro.onBluetoothDeviceFound 回调了某个设备,则此设备会添加到 Taro.getBluetoothDevices 接口获取到的数组中。
287
311
  * - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限
288
- * @supported weapp
312
+ * @supported weapp, alipay, jd
289
313
  * @example
290
314
  * ```tsx
291
315
  * // ArrayBuffer转16进度字符串示例
@@ -313,7 +337,7 @@ declare module '../../index' {
313
337
  ): void
314
338
 
315
339
  /** 监听蓝牙适配器状态变化事件
316
- * @supported weapp
340
+ * @supported weapp, alipay, jd
317
341
  * @example
318
342
  * ```tsx
319
343
  * Taro.onBluetoothAdapterStateChange(function (res) {
@@ -328,7 +352,7 @@ declare module '../../index' {
328
352
  ): void
329
353
 
330
354
  /** 取消监听寻找到新设备的事件
331
- * @supported weapp
355
+ * @supported weapp, alipay
332
356
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html
333
357
  */
334
358
  offBluetoothDeviceFound(
@@ -337,7 +361,7 @@ declare module '../../index' {
337
361
  ): void
338
362
 
339
363
  /** 取消监听蓝牙适配器状态变化事件
340
- * @supported weapp
364
+ * @supported weapp, alipay
341
365
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html
342
366
  */
343
367
  offBluetoothAdapterStateChange(
@@ -357,10 +381,10 @@ declare module '../../index' {
357
381
  * @supported weapp
358
382
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html
359
383
  */
360
- isBluetoothDevicePaired(option: isBluetoothDevicePaired.Option): boolean
384
+ isBluetoothDevicePaired(option: isBluetoothDevicePaired.Option): Promise<TaroGeneral.CallbackResult>
361
385
 
362
386
  /** 根据 uuid 获取处于已连接状态的设备。
363
- * @supported weapp
387
+ * @supported weapp, alipay, jd
364
388
  * @example
365
389
  * ```tsx
366
390
  * Taro.getConnectedBluetoothDevices({
@@ -380,7 +404,7 @@ declare module '../../index' {
380
404
  * **注意事项**
381
405
  * - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 Taro.closeBluetoothAdapter 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。
382
406
  * - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
383
- * @supported weapp
407
+ * @supported weapp, alipay, jd
384
408
  * @example
385
409
  * ```tsx
386
410
  * // ArrayBuffer转16进度字符串示例
@@ -407,7 +431,7 @@ declare module '../../index' {
407
431
  getBluetoothDevices(option?: getBluetoothDevices.Option): Promise<getBluetoothDevices.SuccessCallbackResult>
408
432
 
409
433
  /** 获取本机蓝牙适配器状态。
410
- * @supported weapp
434
+ * @supported weapp, alipay, jd
411
435
  * @example
412
436
  * ```tsx
413
437
  * Taro.getBluetoothAdapterState({
@@ -423,7 +447,7 @@ declare module '../../index' {
423
447
  ): Promise<getBluetoothAdapterState.SuccessCallbackResult>
424
448
 
425
449
  /** 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 Taro.openBluetoothAdapter 成对调用。
426
- * @supported weapp
450
+ * @supported weapp, alipay, jd
427
451
  * @example
428
452
  * ```tsx
429
453
  * Taro.closeBluetoothAdapter({
@@ -28,7 +28,7 @@ declare module '../../index' {
28
28
  /** 重复周期,默认 month 每月重复
29
29
  * @default "month"
30
30
  */
31
- repeatInterval?: string
31
+ repeatInterval?: keyof RepeatInterval
32
32
  /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
33
33
  repeatEndTime?: number
34
34
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -38,6 +38,16 @@ declare module '../../index' {
38
38
  /** 接口调用成功的回调函数 */
39
39
  success?: (result: TaroGeneral.CallbackResult) => void
40
40
  }
41
+ interface RepeatInterval {
42
+ /** 每天重复 */
43
+ day
44
+ /** 每周重复 */
45
+ week
46
+ /** 每月重复。该模式日期不能大于 28 日 */
47
+ month
48
+ /** 每年重复 */
49
+ year
50
+ }
41
51
  }
42
52
 
43
53
  namespace addPhoneCalendar {
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
 
44
44
  interface TaroStatic {
45
45
  /** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
46
- * @supported weapp, h5, rn, tt
46
+ * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
47
47
  * @h5 部分实现
48
48
  * @example
49
49
  * ```tsx
@@ -60,22 +60,22 @@ declare module '../../index' {
60
60
  * ```
61
61
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html
62
62
  */
63
- setClipboardData(option: setClipboardData.Option): Promise<setClipboardData.Promised>
63
+ setClipboardData(option: setClipboardData.Option): Promise<setClipboardData.Promised>
64
64
 
65
- /**
66
- * 获取系统剪贴板内容
67
- * @supported weapp, h5, rn, tt
68
- * @h5 部分实现
69
- * @example
70
- * ```tsx
71
- * Taro.getClipboardData({
72
- * success: function (res){
73
- * console.log(res.data)
74
- * }
75
- * })
76
- * ```
77
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html
78
- */
79
- getClipboardData(res?: getClipboardData.Option): Promise<getClipboardData.Promised>
65
+ /**
66
+ * 获取系统剪贴板内容
67
+ * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
68
+ * @h5 部分实现
69
+ * @example
70
+ * ```tsx
71
+ * Taro.getClipboardData({
72
+ * success: function (res){
73
+ * console.log(res.data)
74
+ * }
75
+ * })
76
+ * ```
77
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html
78
+ */
79
+ getClipboardData(res?: getClipboardData.Option): Promise<getClipboardData.Promised>
80
80
  }
81
81
  }
@@ -59,7 +59,7 @@ declare module '../../index' {
59
59
 
60
60
  interface TaroStatic {
61
61
  /** 停止监听罗盘数据
62
- * @supported weapp, h5, tt
62
+ * @supported weapp, swan, qq, h5, tt
63
63
  * @example
64
64
  * ```tsx
65
65
  * Taro.stopCompass()
@@ -69,7 +69,7 @@ declare module '../../index' {
69
69
  stopCompass(option?: stopCompass.Option): Promise<TaroGeneral.CallbackResult>
70
70
 
71
71
  /** 开始监听罗盘数据
72
- * @supported weapp, h5, tt
72
+ * @supported weapp, swan, qq, h5, tt
73
73
  * @example
74
74
  * ```js
75
75
  * Taro.startCompass()
@@ -79,7 +79,7 @@ declare module '../../index' {
79
79
  startCompass(option?: startCompass.Option): Promise<TaroGeneral.CallbackResult>
80
80
 
81
81
  /** 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 Taro.stopCompass 停止监听。
82
- * @supported weapp, h5, tt
82
+ * @supported weapp, swan, qq, h5, tt
83
83
  * @example
84
84
  * ```tsx
85
85
  * Taro.onCompassChange(function (res) {
@@ -94,12 +94,12 @@ declare module '../../index' {
94
94
  ): void
95
95
 
96
96
  /** 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
97
- * @supported weapp, h5
97
+ * @supported weapp, swan, qq, h5
98
98
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html
99
99
  */
100
100
  offCompassChange(
101
101
  /** 罗盘数据变化事件的回调函数 */
102
- callback: (...args: any[]) => any,
102
+ callback?: onCompassChange.Callback,
103
103
  ): void
104
104
  }
105
105
  }
@@ -53,7 +53,7 @@ declare module '../../index' {
53
53
 
54
54
  interface TaroStatic {
55
55
  /** 停止监听陀螺仪数据。
56
- * @supported weapp, rn, tt
56
+ * @supported weapp, alipay, swan, jd, qq, tt, rn
57
57
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html
58
58
  */
59
59
  stopGyroscope(option?: stopGyroscope.Option): Promise<TaroGeneral.CallbackResult>
@@ -65,7 +65,7 @@ declare module '../../index' {
65
65
  startGyroscope(option: startGyroscope.Option): Promise<TaroGeneral.CallbackResult>
66
66
 
67
67
  /** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
68
- * @supported weapp, rn, tt
68
+ * @supported weapp, alipay, swan, jd, qq, tt, rn
69
69
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
70
70
  */
71
71
  onGyroscopeChange(
@@ -74,12 +74,12 @@ declare module '../../index' {
74
74
  ): void
75
75
 
76
76
  /** 取消监听陀螺仪数据变化事件。
77
- * @supported weapp, rn, tt
77
+ * @supported weapp, alipay, swan, jd, tt, rn
78
78
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html
79
79
  */
80
80
  offGyroscopeChange(
81
81
  /** 陀螺仪数据变化事件的回调函数 */
82
- callback?: (...args: any[]) => any,
82
+ callback?: onGyroscopeChange.Callback,
83
83
  ): void
84
84
  }
85
85
  }
@@ -20,7 +20,9 @@ declare module '../../index' {
20
20
  complete?: (res: TaroGeneral.IBeaconError) => void
21
21
  /** 接口调用失败的回调函数 */
22
22
  fail?: (res: TaroGeneral.IBeaconError) => void
23
- /** 是否校验蓝牙开关,仅在 iOS 下有效 */
23
+ /** 是否校验蓝牙开关,仅在 iOS 下有效
24
+ * @default false
25
+ */
24
26
  ignoreBluetoothAvailable?: boolean
25
27
  /** 接口调用成功的回调函数 */
26
28
  success?: (res: TaroGeneral.IBeaconError) => void
@@ -100,7 +102,7 @@ declare module '../../index' {
100
102
 
101
103
  interface TaroStatic {
102
104
  /** 停止搜索附近的 iBeacon 设备
103
- * @supported weapp
105
+ * @supported weapp, alipay
104
106
  * @example
105
107
  * ```tsx
106
108
  * Taro.stopBeaconDiscovery(params).then(...)
@@ -110,7 +112,7 @@ declare module '../../index' {
110
112
  stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
111
113
 
112
114
  /** 开始搜索附近的 iBeacon 设备
113
- * @supported weapp
115
+ * @supported weapp, alipay
114
116
  * @example
115
117
  * ```tsx
116
118
  * Taro.startBeaconDiscovery({
@@ -122,7 +124,7 @@ declare module '../../index' {
122
124
  startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
123
125
 
124
126
  /** 监听 iBeacon 设备更新事件,仅能注册一个监听
125
- * @supported weapp
127
+ * @supported weapp, alipay
126
128
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html
127
129
  */
128
130
  onBeaconUpdate(
@@ -131,7 +133,7 @@ declare module '../../index' {
131
133
  ): void
132
134
 
133
135
  /** 监听 iBeacon 服务状态变化事件,仅能注册一个监听
134
- * @supported weapp
136
+ * @supported weapp, alipay
135
137
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html
136
138
  */
137
139
  onBeaconServiceChange(
@@ -140,7 +142,7 @@ declare module '../../index' {
140
142
  ): void
141
143
 
142
144
  /** 取消监听 iBeacon 设备更新事件
143
- * @supported weapp
145
+ * @supported weapp, alipay
144
146
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
145
147
  */
146
148
  offBeaconUpdate(
@@ -149,7 +151,7 @@ declare module '../../index' {
149
151
  ): void
150
152
 
151
153
  /** 取消监听 iBeacon 服务状态变化事件
152
- * @supported weapp
154
+ * @supported weapp, alipay
153
155
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html
154
156
  */
155
157
  offBeaconServiceChange(
@@ -158,7 +160,7 @@ declare module '../../index' {
158
160
  ): void
159
161
 
160
162
  /** 获取所有已搜索到的 iBeacon 设备
161
- * @supported weapp
163
+ * @supported weapp, alipay
162
164
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
163
165
  */
164
166
  getBeacons(option?: getBeacons.Option): Promise<getBeacons.CallbackResult>
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
 
44
44
  interface TaroStatic {
45
45
  /** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
46
- * @supported weapp, rn, tt
46
+ * @supported weapp, alipay, swan, jd, tt, rn, harmony_hybrid
47
47
  * @example
48
48
  * ```tsx
49
49
  * Taro.hideKeyboard({
@@ -71,7 +71,7 @@ declare module '../../index' {
71
71
  getSelectedTextRange(option?: getSelectedTextRange.Option): Promise<getSelectedTextRange.SuccessCallbackResult>
72
72
 
73
73
  /** 监听键盘高度变化
74
- * @supported weapp, rn
74
+ * @supported weapp, swan, jd, qq, rn, harmony
75
75
  * @example
76
76
  * ```tsx
77
77
  * Taro.onKeyboardHeightChange(res => {
@@ -80,16 +80,18 @@ declare module '../../index' {
80
80
  * ```
81
81
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html
82
82
  */
83
- onKeyboardHeightChange(callback: onKeyboardHeightChange.Callback): void
83
+ onKeyboardHeightChange(
84
+ callback: onKeyboardHeightChange.Callback
85
+ ): void
84
86
 
85
87
  /**
86
88
  * 取消监听键盘高度变化事件。
87
- * @supported weapp, rn
89
+ * @supported weapp, swan, jd, rn, harmony
88
90
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html
89
91
  */
90
92
  offKeyboardHeightChange(
91
93
  /** 键盘高度变化事件的回调函数 */
92
- callback?: (...args: any[]) => any,
94
+ callback?: onKeyboardHeightChange.Callback
93
95
  ): void
94
96
  }
95
97
  }
@@ -26,7 +26,7 @@ declare module '../../index' {
26
26
  /** 监听内存不足告警事件。
27
27
  *
28
28
  * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
29
- * @supported weapp, tt
29
+ * @supported weapp, alipay, swan, jd, tt
30
30
  * @example
31
31
  * ```tsx
32
32
  * Taro.onMemoryWarning(function () {
@@ -41,13 +41,12 @@ declare module '../../index' {
41
41
  ): void
42
42
 
43
43
  /** 取消监听内存不足告警事件。
44
- * @supported weapp
44
+ * @supported weapp, alipay, swan
45
45
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html
46
46
  */
47
47
  offMemoryWarning(
48
48
  /** 取消监听内存不足告警事件 */
49
- callback: onMemoryWarning.Callback,
49
+ callback?: onMemoryWarning.Callback,
50
50
  ): void
51
-
52
51
  }
53
52
  }
@@ -51,7 +51,7 @@ declare module '../../index' {
51
51
 
52
52
  interface TaroStatic {
53
53
  /** 开始监听设备方向的变化。
54
- * @supported weapp, h5, rn
54
+ * @supported weapp, swan, jd, h5, rn
55
55
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html
56
56
  */
57
57
  startDeviceMotionListening(
@@ -60,7 +60,7 @@ declare module '../../index' {
60
60
 
61
61
  /**
62
62
  * 停止监听设备方向的变化。
63
- * @supported weapp, h5, rn
63
+ * @supported weapp, swan, jd, h5, rn
64
64
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html
65
65
  */
66
66
  stopDeviceMotionListening(
@@ -69,18 +69,20 @@ declare module '../../index' {
69
69
 
70
70
  /**
71
71
  * 监听设备方向变化事件。频率根据 Taro.startDeviceMotionListening() 的 interval 参数。可以使用 Taro.stopDeviceMotionListening() 停止监听。
72
- * @supported weapp, h5, rn
72
+ * @supported weapp, alipay, swan, jd, h5, rn
73
73
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html
74
74
  */
75
- onDeviceMotionChange (callback: onDeviceMotionChange.Callback): void
75
+ onDeviceMotionChange(
76
+ callback: onDeviceMotionChange.Callback
77
+ ): void
76
78
 
77
79
  /** 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
78
- * @supported weapp, h5, rn
80
+ * @supported weapp, alipay, swan, jd, h5, rn
79
81
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html
80
82
  */
81
83
  offDeviceMotionChange(
82
84
  /** 设备方向变化事件的回调函数 */
83
- callback?: (...args: any[]) => any,
85
+ callback?: onDeviceMotionChange.Callback
84
86
  ): void
85
87
  }
86
88
  }
@@ -41,6 +41,10 @@ declare module '../../index' {
41
41
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
42
42
  /** 网络类型 */
43
43
  networkType: keyof NetworkType
44
+ /** 信号强弱,单位 dbm */
45
+ signalStrength?: number
46
+ /** 设备是否使用了网络代理 */
47
+ hasSystemProxy?: boolean
44
48
  /** 调用结果 */
45
49
  errMsg: string
46
50
  }
@@ -76,6 +80,8 @@ declare module '../../index' {
76
80
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
77
81
  /** 本机局域网IP地址 */
78
82
  localip: string
83
+ /** ,基础库 2.24.0 开始支持 */
84
+ netmask?: string
79
85
  /** 调用结果 */
80
86
  errMsg: string
81
87
  }
@@ -83,7 +89,7 @@ declare module '../../index' {
83
89
 
84
90
  interface TaroStatic {
85
91
  /** 监听弱网状态变化事件
86
- * @supported weapp
92
+ * @supported weapp, swan, qq, tt
87
93
  * @example
88
94
  * ```tsx
89
95
  * Taro.onNetworkWeakChange(function (res) {
@@ -101,7 +107,7 @@ declare module '../../index' {
101
107
  ): void
102
108
 
103
109
  /** 监听网络状态变化。
104
- * @supported weapp, h5, rn, tt
110
+ * @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid
105
111
  * @example
106
112
  * ```tsx
107
113
  * Taro.onNetworkStatusChange(function (res) {
@@ -117,16 +123,16 @@ declare module '../../index' {
117
123
  ): void
118
124
 
119
125
  /** 取消监听弱网状态变化事件
120
- * @supported weapp
126
+ * @supported weapp, swan
121
127
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html
122
128
  */
123
129
  offNetworkWeakChange(
124
130
  /** 弱网状态变化事件的回调函数 */
125
- callback: onNetworkWeakChange.Callback,
131
+ callback?: onNetworkWeakChange.Callback,
126
132
  ): void
127
133
 
128
134
  /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
129
- * @supported weapp, h5, rn
135
+ * @supported weapp, swan, h5, rn, harmony, harmony_hybrid
130
136
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
131
137
  */
132
138
  offNetworkStatusChange(
@@ -135,7 +141,7 @@ declare module '../../index' {
135
141
  ): void
136
142
 
137
143
  /** 获取网络类型。
138
- * @supported weapp, h5, rn, tt
144
+ * @supported weapp, swan, qq, h5, rn, tt, harmony, harmony_hybrid
139
145
  * @example
140
146
  * ```tsx
141
147
  * Taro.getNetworkType({
@@ -187,7 +187,7 @@ declare module '../../index' {
187
187
  namespace transceive {
188
188
  interface Option {
189
189
  /** 需要传递的二进制数据 */
190
- transceive: ArrayBuffer
190
+ data: ArrayBuffer
191
191
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
192
192
  complete?: (res: TaroGeneral.NFCError) => void
193
193
  /** 接口调用失败的回调函数 */
@@ -298,7 +298,7 @@ declare module '../../index' {
298
298
  namespace transceive {
299
299
  interface Option {
300
300
  /** 需要传递的二进制数据 */
301
- transceive: ArrayBuffer
301
+ data: ArrayBuffer
302
302
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
303
303
  complete?: (res: TaroGeneral.NFCError) => void
304
304
  /** 接口调用失败的回调函数 */
@@ -409,7 +409,7 @@ declare module '../../index' {
409
409
  namespace transceive {
410
410
  interface Option {
411
411
  /** 需要传递的二进制数据 */
412
- transceive: ArrayBuffer
412
+ data: ArrayBuffer
413
413
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
414
414
  complete?: (res: TaroGeneral.NFCError) => void
415
415
  /** 接口调用失败的回调函数 */
@@ -521,11 +521,11 @@ declare module '../../index' {
521
521
  namespace writeNdefMessage {
522
522
  interface Option {
523
523
  /** uri 数组 */
524
- uris: string[]
524
+ uris?: string[]
525
525
  /** text 数组 */
526
- texts: string[]
526
+ texts?: string[]
527
527
  /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */
528
- records: record[]
528
+ records?: record[]
529
529
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
530
530
  complete?: (res: TaroGeneral.NFCError) => void
531
531
  /** 接口调用失败的回调函数 */
@@ -676,7 +676,7 @@ declare module '../../index' {
676
676
  namespace transceive {
677
677
  interface Option {
678
678
  /** 需要传递的二进制数据 */
679
- transceive: ArrayBuffer
679
+ data: ArrayBuffer
680
680
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
681
681
  complete?: (res: TaroGeneral.NFCError) => void
682
682
  /** 接口调用失败的回调函数 */
@@ -741,7 +741,7 @@ declare module '../../index' {
741
741
  */
742
742
  offDiscovered(
743
743
  /** 监听 NFC Tag的回调函数 */
744
- callback: NFCAdapter.onDiscovered.Callback,
744
+ callback?: NFCAdapter.onDiscovered.Callback,
745
745
  ): void
746
746
  /** 监听 NFC Tag
747
747
  * @supported weapp, tt
@@ -778,7 +778,7 @@ declare module '../../index' {
778
778
  /** NFC标签的UID
779
779
  * @supported tt
780
780
  */
781
- uid?: ArrayBuffer
781
+ id?: ArrayBuffer
782
782
  }
783
783
 
784
784
  interface NdefMessage {
@@ -906,7 +906,7 @@ declare module '../../index' {
906
906
  namespace transceive {
907
907
  interface Option {
908
908
  /** 需要传递的二进制数据 */
909
- transceive: ArrayBuffer
909
+ data: ArrayBuffer
910
910
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
911
911
  complete?: (res: TaroGeneral.NFCError) => void
912
912
  /** 接口调用失败的回调函数 */
@@ -1017,7 +1017,7 @@ declare module '../../index' {
1017
1017
  namespace transceive {
1018
1018
  interface Option {
1019
1019
  /** 需要传递的二进制数据 */
1020
- transceive: ArrayBuffer
1020
+ data: ArrayBuffer
1021
1021
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1022
1022
  complete?: (res: TaroGeneral.NFCError) => void
1023
1023
  /** 接口调用失败的回调函数 */
@@ -1128,7 +1128,7 @@ declare module '../../index' {
1128
1128
  namespace transceive {
1129
1129
  interface Option {
1130
1130
  /** 需要传递的二进制数据 */
1131
- transceive: ArrayBuffer
1131
+ data: ArrayBuffer
1132
1132
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1133
1133
  complete?: (res: TaroGeneral.NFCError) => void
1134
1134
  /** 接口调用失败的回调函数 */
@@ -1212,7 +1212,7 @@ declare module '../../index' {
1212
1212
  */
1213
1213
  offHCEMessage(
1214
1214
  /** 接收 NFC 设备消息事件的回调函数 */
1215
- callback: (...args: any[]) => any,
1215
+ callback: onHCEMessage.Callback,
1216
1216
  ): void
1217
1217
 
1218
1218
  /** 获取 NFC 实例