@spcsn/taro 0.1.2 → 1.0.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.
- package/README.md +13 -6
- package/dist/index.js +223 -1
- package/dist/index.js.map +1 -1
- package/package.json +25 -56
- package/types/api/ad/index.d.ts +3 -6
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +3 -3
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/base/system.d.ts +8 -16
- package/types/api/base/update.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +12 -12
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +71 -72
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +4 -4
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/bluetooth-ble.d.ts +14 -14
- package/types/api/device/bluetooth-peripheral.d.ts +15 -15
- package/types/api/device/bluetooth.d.ts +11 -11
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/device/clipboard.d.ts +2 -4
- package/types/api/device/compass.d.ts +4 -4
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +7 -7
- package/types/api/device/keyboard.d.ts +3 -3
- package/types/api/device/memory.d.ts +2 -2
- package/types/api/device/motion.d.ts +4 -4
- package/types/api/device/network.d.ts +5 -20
- package/types/api/device/nfc.d.ts +17 -17
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +6 -6
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +2 -2
- package/types/api/device/wifi.d.ts +10 -10
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +46 -46
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +38 -45
- package/types/api/media/audio.d.ts +30 -30
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +12 -25
- package/types/api/media/image.d.ts +8 -13
- package/types/api/media/map.d.ts +15 -15
- package/types/api/media/recorder.d.ts +11 -11
- package/types/api/media/video.d.ts +19 -21
- package/types/api/navigate/index.d.ts +2 -2
- package/types/api/network/download.d.ts +7 -8
- package/types/api/network/request.d.ts +14 -33
- package/types/api/network/upload.d.ts +7 -9
- package/types/api/network/websocket.d.ts +14 -14
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +5 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/login.d.ts +5 -5
- package/types/api/open-api/settings.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +15 -15
- package/types/api/open-api/user-info.d.ts +2 -3
- package/types/api/payment/index.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -8
- package/types/api/share/index.d.ts +3 -3
- package/types/api/storage/background-fetch.d.ts +6 -9
- package/types/api/storage/index.d.ts +11 -11
- package/types/api/taro.extend.d.ts +7 -24
- package/types/api/taro.hooks.d.ts +8 -33
- package/types/api/ui/animation.d.ts +33 -36
- package/types/api/ui/background.d.ts +2 -4
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -10
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +5 -7
- package/types/api/ui/pull-down-refresh.d.ts +2 -3
- package/types/api/ui/scroll.d.ts +3 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +19 -23
- package/types/compile/compiler.d.ts +4 -10
- package/types/compile/config/index.d.ts +0 -3
- package/types/compile/config/mini.d.ts +17 -39
- package/types/compile/config/plugin.d.ts +14 -4
- package/types/compile/config/project.d.ts +23 -61
- package/types/compile/config/util.d.ts +18 -73
- package/types/compile/index.d.ts +16 -1
- package/types/compile/viteCompilerContext.d.ts +18 -52
- package/types/global.d.ts +1 -12
- package/types/index.d.ts +0 -11
- package/types/taro.api.d.ts +0 -9
- package/types/taro.component.d.ts +0 -2
- package/types/taro.config.d.ts +0 -120
- package/types/taro.runtime.d.ts +7 -3
- package/types/api/alipay/index.d.ts +0 -69
- package/types/api/qq/index.d.ts +0 -354
- package/types/api/swan/bookshelf.d.ts +0 -307
- package/types/api/swan/download-package.d.ts +0 -80
- package/types/api/swan/index.d.ts +0 -251
- package/types/api/swan/pay.d.ts +0 -139
- package/types/compile/config/h5.d.ts +0 -134
- package/types/compile/config/harmony.d.ts +0 -118
- package/types/compile/config/rn.d.ts +0 -85
|
@@ -311,7 +311,7 @@ declare module '../../index' {
|
|
|
311
311
|
* - 小程序不会对写入数据包大小做限制,但系统与蓝牙设备会限制蓝牙4.0单次传输的数据大小,超过最大字节数后会发生写入错误,建议每次写入不超过20字节。
|
|
312
312
|
* - 若单次写入数据过长,iOS 上存在系统不会有任何回调的情况(包括错误回调)。
|
|
313
313
|
* - 安卓平台上,在调用 `notifyBLECharacteristicValueChange` 成功后立即调用 `writeBLECharacteristicValue` 接口,在部分机型上会发生 10008 系统错误
|
|
314
|
-
* @supported weapp
|
|
314
|
+
* @supported weapp
|
|
315
315
|
* @example
|
|
316
316
|
* ```tsx
|
|
317
317
|
* // 向蓝牙设备发送一个0x00的16进制数据
|
|
@@ -342,7 +342,7 @@ declare module '../../index' {
|
|
|
342
342
|
*
|
|
343
343
|
* - 需在 Taro.createBLEConnection 调用成功后调用
|
|
344
344
|
* - 仅安卓系统 5.1 以上版本有效,iOS 因系统限制不支持。
|
|
345
|
-
* @supported weapp
|
|
345
|
+
* @supported weapp
|
|
346
346
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.setBLEMTU.html
|
|
347
347
|
*/
|
|
348
348
|
setBLEMTU(
|
|
@@ -354,7 +354,7 @@ declare module '../../index' {
|
|
|
354
354
|
* **注意**
|
|
355
355
|
* - 并行调用多次会存在读失败的可能性。
|
|
356
356
|
* - 接口读取到的信息需要在 `onBLECharacteristicValueChange` 方法注册的回调中获取。
|
|
357
|
-
* @supported weapp
|
|
357
|
+
* @supported weapp
|
|
358
358
|
* @example
|
|
359
359
|
* ```tsx
|
|
360
360
|
* // 必须在这里的回调才能获取
|
|
@@ -395,7 +395,7 @@ declare module '../../index' {
|
|
|
395
395
|
): void
|
|
396
396
|
|
|
397
397
|
/** 监听低功耗蓝牙连接状态的改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
|
|
398
|
-
* @supported weapp
|
|
398
|
+
* @supported weapp
|
|
399
399
|
* @example
|
|
400
400
|
* ```tsx
|
|
401
401
|
* Taro.onBLEConnectionStateChange(function (res) {
|
|
@@ -411,7 +411,7 @@ declare module '../../index' {
|
|
|
411
411
|
): void
|
|
412
412
|
|
|
413
413
|
/** 监听低功耗蓝牙设备的特征值变化事件。必须先启用 `notifyBLECharacteristicValueChange` 接口才能接收到设备推送的 notification。
|
|
414
|
-
* @supported weapp
|
|
414
|
+
* @supported weapp
|
|
415
415
|
* @example
|
|
416
416
|
* ```tsx
|
|
417
417
|
* // ArrayBuffer转16进制字符串示例
|
|
@@ -446,7 +446,7 @@ declare module '../../index' {
|
|
|
446
446
|
): void
|
|
447
447
|
|
|
448
448
|
/** 取消监听蓝牙低功耗连接状态的改变事件
|
|
449
|
-
* @supported weapp
|
|
449
|
+
* @supported weapp
|
|
450
450
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html
|
|
451
451
|
*/
|
|
452
452
|
offBLEConnectionStateChange(
|
|
@@ -455,7 +455,7 @@ declare module '../../index' {
|
|
|
455
455
|
): void
|
|
456
456
|
|
|
457
457
|
/** 取消监听蓝牙低功耗设备的特征值变化事件
|
|
458
|
-
* @supported weapp
|
|
458
|
+
* @supported weapp
|
|
459
459
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html
|
|
460
460
|
*/
|
|
461
461
|
offBLECharacteristicValueChange(
|
|
@@ -470,7 +470,7 @@ declare module '../../index' {
|
|
|
470
470
|
* **注意**
|
|
471
471
|
* - 订阅操作成功后需要设备主动更新特征值的 value,才会触发 Taro.onBLECharacteristicValueChange 回调。
|
|
472
472
|
* - 安卓平台上,在调用 `notifyBLECharacteristicValueChange` 成功后立即调用 `writeBLECharacteristicValue` 接口,在部分机型上会发生 10008 系统错误
|
|
473
|
-
* @supported weapp
|
|
473
|
+
* @supported weapp
|
|
474
474
|
* @example
|
|
475
475
|
* ```tsx
|
|
476
476
|
* Taro.notifyBLECharacteristicValueChange({
|
|
@@ -497,7 +497,7 @@ declare module '../../index' {
|
|
|
497
497
|
* 注意:
|
|
498
498
|
* - 小程序中 MTU 为 ATT_MTU,包含 Op-Code 和 Attribute Handle 的长度,实际可以传输的数据长度为 ATT_MTU - 3
|
|
499
499
|
* - iOS 系统中 MTU 为固定值;安卓系统中,MTU 会在系统协商成功之后发生改变,建议使用 [Taro.onBLEMTUChange](/docs/apis/device/bluetooth-ble/onBLEMTUChange) 监听。
|
|
500
|
-
* @supported weapp
|
|
500
|
+
* @supported weapp
|
|
501
501
|
* @example
|
|
502
502
|
* ```tsx
|
|
503
503
|
* Taro.getBLEMTU({
|
|
@@ -515,7 +515,7 @@ declare module '../../index' {
|
|
|
515
515
|
): Promise<getBLEMTU.SuccessCallbackResult>
|
|
516
516
|
|
|
517
517
|
/** 获取蓝牙设备所有服务(service)。
|
|
518
|
-
* @supported weapp
|
|
518
|
+
* @supported weapp
|
|
519
519
|
* @example
|
|
520
520
|
* ```tsx
|
|
521
521
|
* Taro.getBLEDeviceServices({
|
|
@@ -533,7 +533,7 @@ declare module '../../index' {
|
|
|
533
533
|
): Promise<getBLEDeviceServices.SuccessCallbackResult>
|
|
534
534
|
|
|
535
535
|
/** 获取蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI)。
|
|
536
|
-
* @supported weapp
|
|
536
|
+
* @supported weapp
|
|
537
537
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html
|
|
538
538
|
*/
|
|
539
539
|
getBLEDeviceRSSI(
|
|
@@ -541,7 +541,7 @@ declare module '../../index' {
|
|
|
541
541
|
): Promise<getBLEDeviceRSSI.SuccessCallbackResult>
|
|
542
542
|
|
|
543
543
|
/** 获取蓝牙设备某个服务中所有特征值(characteristic)。
|
|
544
|
-
* @supported weapp
|
|
544
|
+
* @supported weapp
|
|
545
545
|
* @example
|
|
546
546
|
* ```tsx
|
|
547
547
|
* Taro.getBLEDeviceCharacteristics({
|
|
@@ -568,7 +568,7 @@ declare module '../../index' {
|
|
|
568
568
|
* - 请保证尽量成对的调用 `createBLEConnection` 和 `closeBLEConnection` 接口。安卓如果多次调用 `createBLEConnection` 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
|
|
569
569
|
* - 蓝牙连接随时可能断开,建议监听 Taro.onBLEConnectionStateChange 回调事件,当蓝牙设备断开时按需执行重连操作
|
|
570
570
|
* - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口,会返回 10006 错误,建议进行重连操作。
|
|
571
|
-
* @supported weapp
|
|
571
|
+
* @supported weapp
|
|
572
572
|
* @example
|
|
573
573
|
* ```tsx
|
|
574
574
|
* Taro.createBLEConnection({
|
|
@@ -584,7 +584,7 @@ declare module '../../index' {
|
|
|
584
584
|
createBLEConnection(option: createBLEConnection.Option): Promise<createBLEConnection.Promised>
|
|
585
585
|
|
|
586
586
|
/** 断开与低功耗蓝牙设备的连接。
|
|
587
|
-
* @supported weapp
|
|
587
|
+
* @supported weapp
|
|
588
588
|
* @example
|
|
589
589
|
* ```tsx
|
|
590
590
|
* Taro.closeBLEConnection({
|
|
@@ -38,7 +38,7 @@ declare module '../../index' {
|
|
|
38
38
|
*/
|
|
39
39
|
interface BLEPeripheralServer {
|
|
40
40
|
/** 添加服务
|
|
41
|
-
* @supported weapp
|
|
41
|
+
* @supported weapp
|
|
42
42
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html
|
|
43
43
|
*/
|
|
44
44
|
addService(option: BLEPeripheralServer.addService.Option): Promise<TaroGeneral.BluetoothError>
|
|
@@ -48,7 +48,7 @@ declare module '../../index' {
|
|
|
48
48
|
*/
|
|
49
49
|
close(option: BLEPeripheralServer.close.Option): Promise<TaroGeneral.BluetoothError>
|
|
50
50
|
/** 取消监听已连接的设备请求读当前外围设备的特征值事件
|
|
51
|
-
* @supported weapp
|
|
51
|
+
* @supported weapp
|
|
52
52
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html
|
|
53
53
|
*/
|
|
54
54
|
offCharacteristicReadRequest(
|
|
@@ -56,7 +56,7 @@ declare module '../../index' {
|
|
|
56
56
|
callback?: BLEPeripheralServer.onCharacteristicReadRequest.Callback,
|
|
57
57
|
): void
|
|
58
58
|
/** 取消监听特征订阅事件
|
|
59
|
-
* @supported weapp
|
|
59
|
+
* @supported weapp
|
|
60
60
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html
|
|
61
61
|
*/
|
|
62
62
|
offCharacteristicSubscribed(
|
|
@@ -72,7 +72,7 @@ declare module '../../index' {
|
|
|
72
72
|
callback?: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback,
|
|
73
73
|
): void
|
|
74
74
|
/** 取消监听已连接的设备请求写当前外围设备的特征值事件
|
|
75
|
-
* @supported weapp
|
|
75
|
+
* @supported weapp
|
|
76
76
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html
|
|
77
77
|
*/
|
|
78
78
|
offCharacteristicWriteRequest(
|
|
@@ -82,7 +82,7 @@ declare module '../../index' {
|
|
|
82
82
|
/** 监听已连接的设备请求读当前外围设备的特征值事件
|
|
83
83
|
*
|
|
84
84
|
* 收到该消息后需要立刻调用 [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) 写回数据,否则主机不会收到响应。
|
|
85
|
-
* @supported weapp
|
|
85
|
+
* @supported weapp
|
|
86
86
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html
|
|
87
87
|
*/
|
|
88
88
|
onCharacteristicReadRequest(
|
|
@@ -90,7 +90,7 @@ declare module '../../index' {
|
|
|
90
90
|
callback: BLEPeripheralServer.onCharacteristicReadRequest.Callback,
|
|
91
91
|
): void
|
|
92
92
|
/** 监听特征订阅事件,仅 iOS 支持
|
|
93
|
-
* @supported weapp
|
|
93
|
+
* @supported weapp
|
|
94
94
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html
|
|
95
95
|
*/
|
|
96
96
|
onCharacteristicSubscribed(
|
|
@@ -98,7 +98,7 @@ declare module '../../index' {
|
|
|
98
98
|
callback: BLEPeripheralServer.onCharacteristicSubscribed.Callback,
|
|
99
99
|
): void
|
|
100
100
|
/** 监听取消特征订阅事件,仅 iOS 支持
|
|
101
|
-
* @supported weapp
|
|
101
|
+
* @supported weapp
|
|
102
102
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html
|
|
103
103
|
*/
|
|
104
104
|
onCharacteristicUnsubscribed(
|
|
@@ -106,7 +106,7 @@ declare module '../../index' {
|
|
|
106
106
|
callback: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback,
|
|
107
107
|
): void
|
|
108
108
|
/** 监听已连接的设备请求写当前外围设备的特征值事件
|
|
109
|
-
* @supported weapp
|
|
109
|
+
* @supported weapp
|
|
110
110
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html
|
|
111
111
|
*/
|
|
112
112
|
onCharacteristicWriteRequest(
|
|
@@ -114,22 +114,22 @@ declare module '../../index' {
|
|
|
114
114
|
callback: BLEPeripheralServer.onCharacteristicWriteRequest.Callback,
|
|
115
115
|
): void
|
|
116
116
|
/** 移除服务
|
|
117
|
-
* @supported weapp
|
|
117
|
+
* @supported weapp
|
|
118
118
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html
|
|
119
119
|
*/
|
|
120
120
|
removeService(option: BLEPeripheralServer.removeService.Option): Promise<TaroGeneral.BluetoothError>
|
|
121
121
|
/** 开始广播本地创建的外围设备
|
|
122
|
-
* @supported weapp
|
|
122
|
+
* @supported weapp
|
|
123
123
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html
|
|
124
124
|
*/
|
|
125
125
|
startAdvertising(option: BLEPeripheralServer.startAdvertising.Option): Promise<TaroGeneral.BluetoothError>
|
|
126
126
|
/** 停止广播
|
|
127
|
-
* @supported weapp
|
|
127
|
+
* @supported weapp
|
|
128
128
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html
|
|
129
129
|
*/
|
|
130
130
|
stopAdvertising(option: BLEPeripheralServer.stopAdvertising.Option): Promise<TaroGeneral.BluetoothError>
|
|
131
131
|
/** 往指定特征写入二进制数据值,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅
|
|
132
|
-
* @supported weapp
|
|
132
|
+
* @supported weapp
|
|
133
133
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html
|
|
134
134
|
*/
|
|
135
135
|
writeCharacteristicValue(option: BLEPeripheralServer.writeCharacteristicValue.Option): Promise<TaroGeneral.BluetoothError>
|
|
@@ -402,7 +402,7 @@ declare module '../../index' {
|
|
|
402
402
|
|
|
403
403
|
interface TaroStatic {
|
|
404
404
|
/** 监听当前外围设备被连接或断开连接事件
|
|
405
|
-
* @supported weapp
|
|
405
|
+
* @supported weapp
|
|
406
406
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html
|
|
407
407
|
*/
|
|
408
408
|
onBLEPeripheralConnectionStateChanged(
|
|
@@ -411,7 +411,7 @@ declare module '../../index' {
|
|
|
411
411
|
): void
|
|
412
412
|
|
|
413
413
|
/** 取消监听当前外围设备被连接或断开连接事件
|
|
414
|
-
* @supported weapp
|
|
414
|
+
* @supported weapp
|
|
415
415
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html
|
|
416
416
|
*/
|
|
417
417
|
offBLEPeripheralConnectionStateChanged(
|
|
@@ -420,7 +420,7 @@ declare module '../../index' {
|
|
|
420
420
|
): void
|
|
421
421
|
|
|
422
422
|
/** 建立本地作为蓝牙低功耗外围设备的服务端,可创建多个
|
|
423
|
-
* @supported weapp
|
|
423
|
+
* @supported weapp
|
|
424
424
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html
|
|
425
425
|
*/
|
|
426
426
|
createBLEPeripheralServer(
|
|
@@ -253,7 +253,7 @@ declare module '../../index' {
|
|
|
253
253
|
|
|
254
254
|
interface TaroStatic {
|
|
255
255
|
/** 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
|
|
256
|
-
* @supported weapp
|
|
256
|
+
* @supported weapp
|
|
257
257
|
* @example
|
|
258
258
|
* ```tsx
|
|
259
259
|
* Taro.stopBluetoothDevicesDiscovery({
|
|
@@ -269,7 +269,7 @@ declare module '../../index' {
|
|
|
269
269
|
): Promise<stopBluetoothDevicesDiscovery.Promised>
|
|
270
270
|
|
|
271
271
|
/** 开始搜寻附近的蓝牙外围设备。**此操作比较耗费系统资源,请在搜索并连接到设备后调用 Taro.stopBluetoothDevicesDiscovery 方法停止搜索。**
|
|
272
|
-
* @supported weapp
|
|
272
|
+
* @supported weapp
|
|
273
273
|
* @example
|
|
274
274
|
* ```tsx
|
|
275
275
|
* // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
|
|
@@ -291,7 +291,7 @@ declare module '../../index' {
|
|
|
291
291
|
* **注意**
|
|
292
292
|
* - 其他蓝牙相关 API 必须在 Taro.openBluetoothAdapter 调用之后使用。否则 API 会返回错误(errCode=10000)。
|
|
293
293
|
* - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 Taro.openBluetoothAdapter 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
|
|
294
|
-
* @supported weapp
|
|
294
|
+
* @supported weapp
|
|
295
295
|
* @example
|
|
296
296
|
* ```tsx
|
|
297
297
|
* Taro.openBluetoothAdapter({
|
|
@@ -309,7 +309,7 @@ declare module '../../index' {
|
|
|
309
309
|
* **注意**
|
|
310
310
|
* - 若在 Taro.onBluetoothDeviceFound 回调了某个设备,则此设备会添加到 Taro.getBluetoothDevices 接口获取到的数组中。
|
|
311
311
|
* - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限
|
|
312
|
-
* @supported weapp
|
|
312
|
+
* @supported weapp
|
|
313
313
|
* @example
|
|
314
314
|
* ```tsx
|
|
315
315
|
* // ArrayBuffer转16进度字符串示例
|
|
@@ -337,7 +337,7 @@ declare module '../../index' {
|
|
|
337
337
|
): void
|
|
338
338
|
|
|
339
339
|
/** 监听蓝牙适配器状态变化事件
|
|
340
|
-
* @supported weapp
|
|
340
|
+
* @supported weapp
|
|
341
341
|
* @example
|
|
342
342
|
* ```tsx
|
|
343
343
|
* Taro.onBluetoothAdapterStateChange(function (res) {
|
|
@@ -352,7 +352,7 @@ declare module '../../index' {
|
|
|
352
352
|
): void
|
|
353
353
|
|
|
354
354
|
/** 取消监听寻找到新设备的事件
|
|
355
|
-
* @supported weapp
|
|
355
|
+
* @supported weapp
|
|
356
356
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html
|
|
357
357
|
*/
|
|
358
358
|
offBluetoothDeviceFound(
|
|
@@ -361,7 +361,7 @@ declare module '../../index' {
|
|
|
361
361
|
): void
|
|
362
362
|
|
|
363
363
|
/** 取消监听蓝牙适配器状态变化事件
|
|
364
|
-
* @supported weapp
|
|
364
|
+
* @supported weapp
|
|
365
365
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html
|
|
366
366
|
*/
|
|
367
367
|
offBluetoothAdapterStateChange(
|
|
@@ -384,7 +384,7 @@ declare module '../../index' {
|
|
|
384
384
|
isBluetoothDevicePaired(option: isBluetoothDevicePaired.Option): Promise<TaroGeneral.CallbackResult>
|
|
385
385
|
|
|
386
386
|
/** 根据 uuid 获取处于已连接状态的设备。
|
|
387
|
-
* @supported weapp
|
|
387
|
+
* @supported weapp
|
|
388
388
|
* @example
|
|
389
389
|
* ```tsx
|
|
390
390
|
* Taro.getConnectedBluetoothDevices({
|
|
@@ -404,7 +404,7 @@ declare module '../../index' {
|
|
|
404
404
|
* **注意事项**
|
|
405
405
|
* - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 Taro.closeBluetoothAdapter 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。
|
|
406
406
|
* - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
|
|
407
|
-
* @supported weapp
|
|
407
|
+
* @supported weapp
|
|
408
408
|
* @example
|
|
409
409
|
* ```tsx
|
|
410
410
|
* // ArrayBuffer转16进度字符串示例
|
|
@@ -431,7 +431,7 @@ declare module '../../index' {
|
|
|
431
431
|
getBluetoothDevices(option?: getBluetoothDevices.Option): Promise<getBluetoothDevices.SuccessCallbackResult>
|
|
432
432
|
|
|
433
433
|
/** 获取本机蓝牙适配器状态。
|
|
434
|
-
* @supported weapp
|
|
434
|
+
* @supported weapp
|
|
435
435
|
* @example
|
|
436
436
|
* ```tsx
|
|
437
437
|
* Taro.getBluetoothAdapterState({
|
|
@@ -447,7 +447,7 @@ declare module '../../index' {
|
|
|
447
447
|
): Promise<getBluetoothAdapterState.SuccessCallbackResult>
|
|
448
448
|
|
|
449
449
|
/** 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 Taro.openBluetoothAdapter 成对调用。
|
|
450
|
-
* @supported weapp
|
|
450
|
+
* @supported weapp
|
|
451
451
|
* @example
|
|
452
452
|
* ```tsx
|
|
453
453
|
* Taro.closeBluetoothAdapter({
|
|
@@ -85,12 +85,12 @@ declare module '../../index' {
|
|
|
85
85
|
|
|
86
86
|
interface TaroStatic {
|
|
87
87
|
/** 向系统日历添加重复事件
|
|
88
|
-
* @supported weapp
|
|
88
|
+
* @supported weapp
|
|
89
89
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
|
|
90
90
|
*/
|
|
91
91
|
addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
92
92
|
/** 向系统日历添加事件
|
|
93
|
-
* @supported weapp
|
|
93
|
+
* @supported weapp
|
|
94
94
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
|
|
95
95
|
*/
|
|
96
96
|
addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -43,8 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
|
|
44
44
|
interface TaroStatic {
|
|
45
45
|
/** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
|
|
46
|
-
* @supported weapp
|
|
47
|
-
* @h5 部分实现
|
|
46
|
+
* @supported weapp
|
|
48
47
|
* @example
|
|
49
48
|
* ```tsx
|
|
50
49
|
* Taro.setClipboardData({
|
|
@@ -64,8 +63,7 @@ declare module '../../index' {
|
|
|
64
63
|
|
|
65
64
|
/**
|
|
66
65
|
* 获取系统剪贴板内容
|
|
67
|
-
* @supported weapp
|
|
68
|
-
* @h5 部分实现
|
|
66
|
+
* @supported weapp
|
|
69
67
|
* @example
|
|
70
68
|
* ```tsx
|
|
71
69
|
* Taro.getClipboardData({
|
|
@@ -59,7 +59,7 @@ declare module '../../index' {
|
|
|
59
59
|
|
|
60
60
|
interface TaroStatic {
|
|
61
61
|
/** 停止监听罗盘数据
|
|
62
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp
|
|
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
|
|
72
|
+
* @supported weapp
|
|
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
|
|
82
|
+
* @supported weapp
|
|
83
83
|
* @example
|
|
84
84
|
* ```tsx
|
|
85
85
|
* Taro.onCompassChange(function (res) {
|
|
@@ -94,7 +94,7 @@ declare module '../../index' {
|
|
|
94
94
|
): void
|
|
95
95
|
|
|
96
96
|
/** 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
|
|
97
|
-
* @supported weapp
|
|
97
|
+
* @supported weapp
|
|
98
98
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html
|
|
99
99
|
*/
|
|
100
100
|
offCompassChange(
|
|
@@ -53,19 +53,19 @@ declare module '../../index' {
|
|
|
53
53
|
|
|
54
54
|
interface TaroStatic {
|
|
55
55
|
/** 停止监听陀螺仪数据。
|
|
56
|
-
* @supported weapp
|
|
56
|
+
* @supported weapp
|
|
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>
|
|
60
60
|
|
|
61
61
|
/** 开始监听陀螺仪数据。
|
|
62
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp
|
|
63
63
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html
|
|
64
64
|
*/
|
|
65
65
|
startGyroscope(option: startGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
66
66
|
|
|
67
67
|
/** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
|
|
68
|
-
* @supported weapp
|
|
68
|
+
* @supported weapp
|
|
69
69
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
70
70
|
*/
|
|
71
71
|
onGyroscopeChange(
|
|
@@ -74,7 +74,7 @@ declare module '../../index' {
|
|
|
74
74
|
): void
|
|
75
75
|
|
|
76
76
|
/** 取消监听陀螺仪数据变化事件。
|
|
77
|
-
* @supported weapp
|
|
77
|
+
* @supported weapp
|
|
78
78
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html
|
|
79
79
|
*/
|
|
80
80
|
offGyroscopeChange(
|
|
@@ -102,7 +102,7 @@ declare module '../../index' {
|
|
|
102
102
|
|
|
103
103
|
interface TaroStatic {
|
|
104
104
|
/** 停止搜索附近的 iBeacon 设备
|
|
105
|
-
* @supported weapp
|
|
105
|
+
* @supported weapp
|
|
106
106
|
* @example
|
|
107
107
|
* ```tsx
|
|
108
108
|
* Taro.stopBeaconDiscovery(params).then(...)
|
|
@@ -112,7 +112,7 @@ declare module '../../index' {
|
|
|
112
112
|
stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
113
113
|
|
|
114
114
|
/** 开始搜索附近的 iBeacon 设备
|
|
115
|
-
* @supported weapp
|
|
115
|
+
* @supported weapp
|
|
116
116
|
* @example
|
|
117
117
|
* ```tsx
|
|
118
118
|
* Taro.startBeaconDiscovery({
|
|
@@ -124,7 +124,7 @@ declare module '../../index' {
|
|
|
124
124
|
startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
125
125
|
|
|
126
126
|
/** 监听 iBeacon 设备更新事件,仅能注册一个监听
|
|
127
|
-
* @supported weapp
|
|
127
|
+
* @supported weapp
|
|
128
128
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html
|
|
129
129
|
*/
|
|
130
130
|
onBeaconUpdate(
|
|
@@ -133,7 +133,7 @@ declare module '../../index' {
|
|
|
133
133
|
): void
|
|
134
134
|
|
|
135
135
|
/** 监听 iBeacon 服务状态变化事件,仅能注册一个监听
|
|
136
|
-
* @supported weapp
|
|
136
|
+
* @supported weapp
|
|
137
137
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html
|
|
138
138
|
*/
|
|
139
139
|
onBeaconServiceChange(
|
|
@@ -142,7 +142,7 @@ declare module '../../index' {
|
|
|
142
142
|
): void
|
|
143
143
|
|
|
144
144
|
/** 取消监听 iBeacon 设备更新事件
|
|
145
|
-
* @supported weapp
|
|
145
|
+
* @supported weapp
|
|
146
146
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
|
|
147
147
|
*/
|
|
148
148
|
offBeaconUpdate(
|
|
@@ -151,7 +151,7 @@ declare module '../../index' {
|
|
|
151
151
|
): void
|
|
152
152
|
|
|
153
153
|
/** 取消监听 iBeacon 服务状态变化事件
|
|
154
|
-
* @supported weapp
|
|
154
|
+
* @supported weapp
|
|
155
155
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html
|
|
156
156
|
*/
|
|
157
157
|
offBeaconServiceChange(
|
|
@@ -160,7 +160,7 @@ declare module '../../index' {
|
|
|
160
160
|
): void
|
|
161
161
|
|
|
162
162
|
/** 获取所有已搜索到的 iBeacon 设备
|
|
163
|
-
* @supported weapp
|
|
163
|
+
* @supported weapp
|
|
164
164
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
|
|
165
165
|
*/
|
|
166
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
|
|
46
|
+
* @supported weapp
|
|
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
|
|
74
|
+
* @supported weapp
|
|
75
75
|
* @example
|
|
76
76
|
* ```tsx
|
|
77
77
|
* Taro.onKeyboardHeightChange(res => {
|
|
@@ -86,7 +86,7 @@ declare module '../../index' {
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* 取消监听键盘高度变化事件。
|
|
89
|
-
* @supported weapp
|
|
89
|
+
* @supported weapp
|
|
90
90
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html
|
|
91
91
|
*/
|
|
92
92
|
offKeyboardHeightChange(
|
|
@@ -26,7 +26,7 @@ declare module '../../index' {
|
|
|
26
26
|
/** 监听内存不足告警事件。
|
|
27
27
|
*
|
|
28
28
|
* 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
|
|
29
|
-
* @supported weapp
|
|
29
|
+
* @supported weapp
|
|
30
30
|
* @example
|
|
31
31
|
* ```tsx
|
|
32
32
|
* Taro.onMemoryWarning(function () {
|
|
@@ -41,7 +41,7 @@ declare module '../../index' {
|
|
|
41
41
|
): void
|
|
42
42
|
|
|
43
43
|
/** 取消监听内存不足告警事件。
|
|
44
|
-
* @supported weapp
|
|
44
|
+
* @supported weapp
|
|
45
45
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html
|
|
46
46
|
*/
|
|
47
47
|
offMemoryWarning(
|
|
@@ -51,7 +51,7 @@ declare module '../../index' {
|
|
|
51
51
|
|
|
52
52
|
interface TaroStatic {
|
|
53
53
|
/** 开始监听设备方向的变化。
|
|
54
|
-
* @supported weapp
|
|
54
|
+
* @supported weapp
|
|
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
|
|
63
|
+
* @supported weapp
|
|
64
64
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html
|
|
65
65
|
*/
|
|
66
66
|
stopDeviceMotionListening(
|
|
@@ -69,7 +69,7 @@ declare module '../../index' {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* 监听设备方向变化事件。频率根据 Taro.startDeviceMotionListening() 的 interval 参数。可以使用 Taro.stopDeviceMotionListening() 停止监听。
|
|
72
|
-
* @supported weapp
|
|
72
|
+
* @supported weapp
|
|
73
73
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html
|
|
74
74
|
*/
|
|
75
75
|
onDeviceMotionChange(
|
|
@@ -77,7 +77,7 @@ declare module '../../index' {
|
|
|
77
77
|
): void
|
|
78
78
|
|
|
79
79
|
/** 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
|
|
80
|
-
* @supported weapp
|
|
80
|
+
* @supported weapp
|
|
81
81
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html
|
|
82
82
|
*/
|
|
83
83
|
offDeviceMotionChange(
|
|
@@ -89,25 +89,10 @@ declare module '../../index' {
|
|
|
89
89
|
|
|
90
90
|
interface TaroStatic {
|
|
91
91
|
/** 监听弱网状态变化事件
|
|
92
|
-
* @supported weapp
|
|
93
|
-
* @example
|
|
94
|
-
* ```tsx
|
|
95
|
-
* Taro.onNetworkWeakChange(function (res) {
|
|
96
|
-
* console.log(res.weakNet)
|
|
97
|
-
* console.log(res.networkType)
|
|
98
|
-
* })
|
|
99
|
-
* // 取消监听
|
|
100
|
-
* Taro.offNetworkWeakChange()
|
|
101
|
-
* ```
|
|
102
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html
|
|
103
|
-
*/
|
|
104
|
-
onNetworkWeakChange(
|
|
105
|
-
/** 弱网状态变化事件的回调函数 */
|
|
106
|
-
callback: onNetworkWeakChange.Callback,
|
|
107
|
-
): void
|
|
92
|
+
* @supported weapp
|
|
108
93
|
|
|
109
94
|
/** 监听网络状态变化。
|
|
110
|
-
* @supported weapp
|
|
95
|
+
* @supported weapp
|
|
111
96
|
* @example
|
|
112
97
|
* ```tsx
|
|
113
98
|
* Taro.onNetworkStatusChange(function (res) {
|
|
@@ -123,7 +108,7 @@ declare module '../../index' {
|
|
|
123
108
|
): void
|
|
124
109
|
|
|
125
110
|
/** 取消监听弱网状态变化事件
|
|
126
|
-
* @supported weapp
|
|
111
|
+
* @supported weapp
|
|
127
112
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html
|
|
128
113
|
*/
|
|
129
114
|
offNetworkWeakChange(
|
|
@@ -132,7 +117,7 @@ declare module '../../index' {
|
|
|
132
117
|
): void
|
|
133
118
|
|
|
134
119
|
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
|
|
135
|
-
* @supported weapp
|
|
120
|
+
* @supported weapp
|
|
136
121
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
|
|
137
122
|
*/
|
|
138
123
|
offNetworkStatusChange(
|
|
@@ -141,7 +126,7 @@ declare module '../../index' {
|
|
|
141
126
|
): void
|
|
142
127
|
|
|
143
128
|
/** 获取网络类型。
|
|
144
|
-
* @supported weapp
|
|
129
|
+
* @supported weapp
|
|
145
130
|
* @example
|
|
146
131
|
* ```tsx
|
|
147
132
|
* Taro.getNetworkType({
|