@tarojs/taro 3.3.11 → 3.3.15
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/package.json +5 -5
- package/types/api/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +80 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +32 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +167 -121
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/global.d.ts +390 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +33 -75
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace stopCompass {
|
|
3
5
|
interface Option {
|
|
4
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
5
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
6
8
|
/** 接口调用失败的回调函数 */
|
|
7
|
-
fail?: (res:
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
8
10
|
/** 接口调用成功的回调函数 */
|
|
9
|
-
success?: (res:
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
/** 停止监听罗盘数据
|
|
13
|
-
* @supported weapp, h5
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* Taro.stopCompass()
|
|
17
|
-
* ```
|
|
18
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html
|
|
19
|
-
*/
|
|
20
|
-
function stopCompass(option?: stopCompass.Option): Promise<General.CallbackResult>
|
|
21
14
|
|
|
22
15
|
namespace startCompass {
|
|
23
16
|
interface Option {
|
|
24
17
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
25
|
-
complete?: (res:
|
|
18
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
26
19
|
/** 接口调用失败的回调函数 */
|
|
27
|
-
fail?: (res:
|
|
20
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
28
21
|
/** 接口调用成功的回调函数 */
|
|
29
|
-
success?: (res:
|
|
22
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
30
23
|
}
|
|
31
24
|
}
|
|
32
|
-
/** 开始监听罗盘数据
|
|
33
|
-
* @supported weapp, h5
|
|
34
|
-
* @example
|
|
35
|
-
* ```js
|
|
36
|
-
* Taro.startCompass()
|
|
37
|
-
* ```
|
|
38
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html
|
|
39
|
-
*/
|
|
40
|
-
function startCompass(option?: startCompass.Option): Promise<General.CallbackResult>
|
|
41
25
|
|
|
42
26
|
namespace onCompassChange {
|
|
43
27
|
/** 罗盘数据变化事件的回调函数 */
|
|
@@ -46,7 +30,7 @@ declare namespace Taro {
|
|
|
46
30
|
) => void
|
|
47
31
|
interface OnCompassChangeCallbackResult {
|
|
48
32
|
/** 精度
|
|
49
|
-
*
|
|
33
|
+
*
|
|
50
34
|
* 由于平台差异,accuracy 在 iOS/Android 的值不同。
|
|
51
35
|
*
|
|
52
36
|
* - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
|
|
@@ -72,27 +56,50 @@ declare namespace Taro {
|
|
|
72
56
|
'unknow ${value}'
|
|
73
57
|
}
|
|
74
58
|
}
|
|
75
|
-
/** 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 Taro.stopCompass 停止监听。
|
|
76
|
-
* @supported weapp, h5
|
|
77
|
-
* @example
|
|
78
|
-
* ```tsx
|
|
79
|
-
* Taro.onCompassChange(function (res) {
|
|
80
|
-
* console.log(res.direction)
|
|
81
|
-
* })
|
|
82
|
-
* ```
|
|
83
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html
|
|
84
|
-
*/
|
|
85
|
-
function onCompassChange(
|
|
86
|
-
/** 罗盘数据变化事件的回调函数 */
|
|
87
|
-
callback: onCompassChange.Callback,
|
|
88
|
-
): void
|
|
89
59
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
60
|
+
interface TaroStatic {
|
|
61
|
+
/** 停止监听罗盘数据
|
|
62
|
+
* @supported weapp, h5
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* Taro.stopCompass()
|
|
66
|
+
* ```
|
|
67
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html
|
|
68
|
+
*/
|
|
69
|
+
stopCompass(option?: stopCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
70
|
+
|
|
71
|
+
/** 开始监听罗盘数据
|
|
72
|
+
* @supported weapp, h5
|
|
73
|
+
* @example
|
|
74
|
+
* ```js
|
|
75
|
+
* Taro.startCompass()
|
|
76
|
+
* ```
|
|
77
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html
|
|
78
|
+
*/
|
|
79
|
+
startCompass(option?: startCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
80
|
+
|
|
81
|
+
/** 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 Taro.stopCompass 停止监听。
|
|
82
|
+
* @supported weapp, h5
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* Taro.onCompassChange(function (res) {
|
|
86
|
+
* console.log(res.direction)
|
|
87
|
+
* })
|
|
88
|
+
* ```
|
|
89
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html
|
|
90
|
+
*/
|
|
91
|
+
onCompassChange(
|
|
92
|
+
/** 罗盘数据变化事件的回调函数 */
|
|
93
|
+
callback: onCompassChange.Callback,
|
|
94
|
+
): void
|
|
95
|
+
|
|
96
|
+
/** 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
|
|
97
|
+
* @supported weapp
|
|
98
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html
|
|
99
|
+
*/
|
|
100
|
+
offCompassChange(
|
|
101
|
+
/** 罗盘数据变化事件的回调函数 */
|
|
102
|
+
callback: (...args: any[]) => any,
|
|
103
|
+
): void
|
|
104
|
+
}
|
|
98
105
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace addPhoneContact {
|
|
3
5
|
interface Option {
|
|
4
6
|
/** 名字 */
|
|
@@ -14,11 +16,11 @@ declare namespace Taro {
|
|
|
14
16
|
/** 联系地址街道 */
|
|
15
17
|
addressStreet?: string
|
|
16
18
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
17
|
-
complete?: (res:
|
|
19
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
18
20
|
/** 电子邮件 */
|
|
19
21
|
email?: string
|
|
20
22
|
/** 接口调用失败的回调函数 */
|
|
21
|
-
fail?: (res:
|
|
23
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
22
24
|
/** 住宅地址城市 */
|
|
23
25
|
homeAddressCity?: string
|
|
24
26
|
/** 住宅地址国家 */
|
|
@@ -50,7 +52,7 @@ declare namespace Taro {
|
|
|
50
52
|
/** 备注 */
|
|
51
53
|
remark?: string
|
|
52
54
|
/** 接口调用成功的回调函数 */
|
|
53
|
-
success?: (res:
|
|
55
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
54
56
|
/** 职位 */
|
|
55
57
|
title?: string
|
|
56
58
|
/** 网站 */
|
|
@@ -74,9 +76,11 @@ declare namespace Taro {
|
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
interface TaroStatic {
|
|
80
|
+
/** 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
|
|
81
|
+
* @supported weapp
|
|
82
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html
|
|
83
|
+
*/
|
|
84
|
+
addPhoneContact(option: addPhoneContact.Option): Promise<TaroGeneral.CallbackResult>
|
|
85
|
+
}
|
|
82
86
|
}
|
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
/** 停止监听陀螺仪数据。
|
|
3
|
-
* @supported weapp
|
|
4
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html
|
|
5
|
-
*/
|
|
6
|
-
function stopGyroscope(option?: stopGyroscope.Option): Promise<General.CallbackResult>
|
|
1
|
+
import Taro from '../../index'
|
|
7
2
|
|
|
3
|
+
declare module '../../index' {
|
|
8
4
|
namespace stopGyroscope {
|
|
9
5
|
interface Option {
|
|
10
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
11
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
12
8
|
/** 接口调用失败的回调函数 */
|
|
13
|
-
fail?: (res:
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
14
10
|
/** 接口调用成功的回调函数 */
|
|
15
|
-
success?: (res:
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
16
12
|
}
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
/** 开始监听陀螺仪数据。
|
|
20
|
-
* @supported weapp
|
|
21
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html
|
|
22
|
-
*/
|
|
23
|
-
function startGyroscope(option: startGyroscope.Option): Promise<General.CallbackResult>
|
|
24
|
-
|
|
25
15
|
|
|
26
16
|
namespace startGyroscope {
|
|
27
17
|
interface Option {
|
|
28
18
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
29
|
-
complete?: (res:
|
|
19
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
30
20
|
/** 接口调用失败的回调函数 */
|
|
31
|
-
fail?: (res:
|
|
21
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
32
22
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
33
23
|
interval?: keyof interval
|
|
34
24
|
/** 接口调用成功的回调函数 */
|
|
35
|
-
success?: (res:
|
|
25
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
36
26
|
}
|
|
37
27
|
|
|
38
28
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
@@ -45,15 +35,7 @@ declare namespace Taro {
|
|
|
45
35
|
normal
|
|
46
36
|
}
|
|
47
37
|
}
|
|
48
|
-
|
|
49
|
-
/** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
|
|
50
|
-
* @supported weapp
|
|
51
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
52
|
-
*/
|
|
53
|
-
function onGyroscopeChange(
|
|
54
|
-
/** 陀螺仪数据变化事件的回调函数 */
|
|
55
|
-
callback: onGyroscopeChange.Callback,
|
|
56
|
-
): void
|
|
38
|
+
|
|
57
39
|
namespace onGyroscopeChange {
|
|
58
40
|
/** 陀螺仪数据变化事件的回调函数 */
|
|
59
41
|
type Callback = (
|
|
@@ -68,12 +50,36 @@ declare namespace Taro {
|
|
|
68
50
|
z: number
|
|
69
51
|
}
|
|
70
52
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
|
|
54
|
+
interface TaroStatic {
|
|
55
|
+
/** 停止监听陀螺仪数据。
|
|
56
|
+
* @supported weapp
|
|
57
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html
|
|
58
|
+
*/
|
|
59
|
+
stopGyroscope(option?: stopGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
60
|
+
|
|
61
|
+
/** 开始监听陀螺仪数据。
|
|
62
|
+
* @supported weapp
|
|
63
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html
|
|
64
|
+
*/
|
|
65
|
+
startGyroscope(option: startGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
66
|
+
|
|
67
|
+
/** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
|
|
68
|
+
* @supported weapp
|
|
69
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
70
|
+
*/
|
|
71
|
+
onGyroscopeChange(
|
|
72
|
+
/** 陀螺仪数据变化事件的回调函数 */
|
|
73
|
+
callback: onGyroscopeChange.Callback,
|
|
74
|
+
): void
|
|
75
|
+
|
|
76
|
+
/** 取消监听陀螺仪数据变化事件。
|
|
77
|
+
* @supported weapp, rn
|
|
78
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html
|
|
79
|
+
*/
|
|
80
|
+
offGyroscopeChange(
|
|
81
|
+
/** 陀螺仪数据变化事件的回调函数 */
|
|
82
|
+
callback?: (...args: any[]) => any,
|
|
83
|
+
): void
|
|
84
|
+
}
|
|
79
85
|
}
|
|
@@ -1,52 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace stopBeaconDiscovery {
|
|
3
5
|
interface Option {
|
|
4
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
5
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
6
8
|
/** 接口调用失败的回调函数 */
|
|
7
|
-
fail?: (res:
|
|
9
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
8
10
|
/** 接口调用成功的回调函数 */
|
|
9
|
-
success?: (res:
|
|
10
|
-
|
|
11
|
+
success?: (res: TaroGeneral.IBeaconError) => void
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
/** 停止搜索附近的 iBeacon 设备
|
|
14
|
-
* @supported weapp
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* Taro.stopBeaconDiscovery(params).then(...)
|
|
18
|
-
* ```
|
|
19
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html
|
|
20
|
-
*/
|
|
21
|
-
function stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<General.CallbackResult>
|
|
22
|
-
|
|
23
15
|
namespace startBeaconDiscovery {
|
|
24
16
|
interface Option {
|
|
25
17
|
/** iBeacon 设备广播的 uuid 列表 */
|
|
26
18
|
uuids: string[]
|
|
27
19
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
28
|
-
complete?: (res:
|
|
20
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
29
21
|
/** 接口调用失败的回调函数 */
|
|
30
|
-
fail?: (res:
|
|
22
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
31
23
|
/** 是否校验蓝牙开关,仅在 iOS 下有效 */
|
|
32
24
|
ignoreBluetoothAvailable?: boolean
|
|
33
25
|
/** 接口调用成功的回调函数 */
|
|
34
|
-
success?: (res:
|
|
26
|
+
success?: (res: TaroGeneral.IBeaconError) => void
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
|
|
38
|
-
/** 开始搜索附近的 iBeacon 设备
|
|
39
|
-
* @supported weapp
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* Taro.startBeaconDiscovery({
|
|
43
|
-
* success: function (res) { }
|
|
44
|
-
* })
|
|
45
|
-
* ```
|
|
46
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html
|
|
47
|
-
*/
|
|
48
|
-
function startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<General.CallbackResult>
|
|
49
|
-
|
|
50
30
|
namespace onBeaconUpdate {
|
|
51
31
|
/** iBeacon 设备更新事件的回调函数 */
|
|
52
32
|
type Callback = (result: CallbackResult) => void
|
|
@@ -56,14 +36,6 @@ declare namespace Taro {
|
|
|
56
36
|
beacons: IBeaconInfo[]
|
|
57
37
|
}
|
|
58
38
|
}
|
|
59
|
-
/** 监听 iBeacon 设备更新事件,仅能注册一个监听
|
|
60
|
-
* @supported weapp
|
|
61
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html
|
|
62
|
-
*/
|
|
63
|
-
function onBeaconUpdate(
|
|
64
|
-
/** iBeacon 设备更新事件的回调函数 */
|
|
65
|
-
callback: onBeaconUpdate.Callback,
|
|
66
|
-
): void
|
|
67
39
|
|
|
68
40
|
namespace onBeaconServiceChange {
|
|
69
41
|
/** iBeacon 服务状态变化事件的回调函数 */
|
|
@@ -79,26 +51,17 @@ declare namespace Taro {
|
|
|
79
51
|
}
|
|
80
52
|
}
|
|
81
53
|
|
|
82
|
-
/** 监听 iBeacon 服务状态变化事件,仅能注册一个监听
|
|
83
|
-
* @supported weapp
|
|
84
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html
|
|
85
|
-
*/
|
|
86
|
-
function onBeaconServiceChange(
|
|
87
|
-
/** iBeacon 服务状态变化事件的回调函数 */
|
|
88
|
-
callback: onBeaconServiceChange.Callback,
|
|
89
|
-
): void
|
|
90
|
-
|
|
91
54
|
namespace getBeacons {
|
|
92
55
|
interface Option {
|
|
93
56
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
94
|
-
complete?: (res:
|
|
57
|
+
complete?: (res: TaroGeneral.IBeaconError) => void
|
|
95
58
|
/** 接口调用失败的回调函数 */
|
|
96
|
-
fail?: (res:
|
|
59
|
+
fail?: (res: TaroGeneral.IBeaconError) => void
|
|
97
60
|
/** 接口调用成功的回调函数 */
|
|
98
61
|
success?: (result: CallbackResult) => void
|
|
99
62
|
}
|
|
100
63
|
|
|
101
|
-
interface CallbackResult extends
|
|
64
|
+
interface CallbackResult extends TaroGeneral.IBeaconError {
|
|
102
65
|
/** iBeacon 设备列表 */
|
|
103
66
|
beacons: IBeaconInfo[]
|
|
104
67
|
/** 调用结果 */
|
|
@@ -106,29 +69,6 @@ declare namespace Taro {
|
|
|
106
69
|
}
|
|
107
70
|
}
|
|
108
71
|
|
|
109
|
-
/** 获取所有已搜索到的 iBeacon 设备
|
|
110
|
-
* @supported weapp
|
|
111
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
|
|
112
|
-
*/
|
|
113
|
-
function getBeacons(option?: getBeacons.Option): Promise<getBeacons.CallbackResult>
|
|
114
|
-
|
|
115
|
-
/** 取消监听 iBeacon 设备更新事件
|
|
116
|
-
* @supported weapp
|
|
117
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
|
|
118
|
-
*/
|
|
119
|
-
function offBeaconUpdate(
|
|
120
|
-
/** iBeacon 设备更新事件的回调函数 */
|
|
121
|
-
callback: (res: General.CallbackResult) => void,
|
|
122
|
-
): void
|
|
123
|
-
|
|
124
|
-
/** 取消监听 iBeacon 服务状态变化事件
|
|
125
|
-
* @supported weapp
|
|
126
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html
|
|
127
|
-
*/
|
|
128
|
-
function offBeaconServiceChange(
|
|
129
|
-
/** iBeacon 服务状态变化事件的回调函数 */
|
|
130
|
-
callback: (res: General.CallbackResult) => void,
|
|
131
|
-
): void
|
|
132
72
|
interface IBeaconInfo {
|
|
133
73
|
/** iBeacon 设备的距离 */
|
|
134
74
|
accuracy: number
|
|
@@ -143,4 +83,70 @@ declare namespace Taro {
|
|
|
143
83
|
/** iBeacon 设备广播的 uuid */
|
|
144
84
|
uuid: string
|
|
145
85
|
}
|
|
86
|
+
|
|
87
|
+
interface TaroStatic {
|
|
88
|
+
/** 停止搜索附近的 iBeacon 设备
|
|
89
|
+
* @supported weapp
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* Taro.stopBeaconDiscovery(params).then(...)
|
|
93
|
+
* ```
|
|
94
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html
|
|
95
|
+
*/
|
|
96
|
+
stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.CallbackResult>
|
|
97
|
+
|
|
98
|
+
/** 开始搜索附近的 iBeacon 设备
|
|
99
|
+
* @supported weapp
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* Taro.startBeaconDiscovery({
|
|
103
|
+
* success: function (res) { }
|
|
104
|
+
* })
|
|
105
|
+
* ```
|
|
106
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html
|
|
107
|
+
*/
|
|
108
|
+
startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.CallbackResult>
|
|
109
|
+
|
|
110
|
+
/** 监听 iBeacon 设备更新事件,仅能注册一个监听
|
|
111
|
+
* @supported weapp
|
|
112
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html
|
|
113
|
+
*/
|
|
114
|
+
onBeaconUpdate(
|
|
115
|
+
/** iBeacon 设备更新事件的回调函数 */
|
|
116
|
+
callback: onBeaconUpdate.Callback,
|
|
117
|
+
): void
|
|
118
|
+
|
|
119
|
+
/** 监听 iBeacon 服务状态变化事件,仅能注册一个监听
|
|
120
|
+
* @supported weapp
|
|
121
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html
|
|
122
|
+
*/
|
|
123
|
+
onBeaconServiceChange(
|
|
124
|
+
/** iBeacon 服务状态变化事件的回调函数 */
|
|
125
|
+
callback: onBeaconServiceChange.Callback,
|
|
126
|
+
): void
|
|
127
|
+
|
|
128
|
+
/** 获取所有已搜索到的 iBeacon 设备
|
|
129
|
+
* @supported weapp
|
|
130
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
|
|
131
|
+
*/
|
|
132
|
+
getBeacons(option?: getBeacons.Option): Promise<getBeacons.CallbackResult>
|
|
133
|
+
|
|
134
|
+
/** 取消监听 iBeacon 设备更新事件
|
|
135
|
+
* @supported weapp
|
|
136
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
|
|
137
|
+
*/
|
|
138
|
+
offBeaconUpdate(
|
|
139
|
+
/** iBeacon 设备更新事件的回调函数 */
|
|
140
|
+
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
141
|
+
): void
|
|
142
|
+
|
|
143
|
+
/** 取消监听 iBeacon 服务状态变化事件
|
|
144
|
+
* @supported weapp
|
|
145
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html
|
|
146
|
+
*/
|
|
147
|
+
offBeaconServiceChange(
|
|
148
|
+
/** iBeacon 服务状态变化事件的回调函数 */
|
|
149
|
+
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
150
|
+
): void
|
|
151
|
+
}
|
|
146
152
|
}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
/** 开始监听设备方向的变化。
|
|
3
|
-
* @supported weapp, h5, rn
|
|
4
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html
|
|
5
|
-
*/
|
|
6
|
-
function startDeviceMotionListening(
|
|
7
|
-
option: startDeviceMotionListening.Option,
|
|
8
|
-
): void
|
|
1
|
+
import Taro from '../../index'
|
|
9
2
|
|
|
3
|
+
declare module '../../index' {
|
|
10
4
|
namespace startDeviceMotionListening {
|
|
11
5
|
interface Option {
|
|
12
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
8
|
/** 接口调用失败的回调函数 */
|
|
15
|
-
fail?: (res:
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
16
10
|
/** 监听设备方向的变化回调函数的执行频率
|
|
17
11
|
* @default "normal"
|
|
18
12
|
*/
|
|
19
13
|
interval?: keyof interval
|
|
20
14
|
/** 接口调用成功的回调函数 */
|
|
21
|
-
success?: (res:
|
|
15
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
22
16
|
}
|
|
23
17
|
interface interval {
|
|
24
18
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
@@ -30,31 +24,16 @@ declare namespace Taro {
|
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
/**
|
|
34
|
-
* 停止监听设备方向的变化。
|
|
35
|
-
* @supported weapp, h5, rn
|
|
36
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html
|
|
37
|
-
*/
|
|
38
|
-
function stopDeviceMotionListening(
|
|
39
|
-
option?: stopDeviceMotionListening.Option,
|
|
40
|
-
): void
|
|
41
|
-
|
|
42
27
|
namespace stopDeviceMotionListening {
|
|
43
28
|
interface Option {
|
|
44
29
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
45
|
-
complete?: (res:
|
|
30
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
46
31
|
/** 接口调用失败的回调函数 */
|
|
47
|
-
fail?: (res:
|
|
32
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
48
33
|
/** 接口调用成功的回调函数 */
|
|
49
|
-
success?: (res:
|
|
34
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
50
35
|
}
|
|
51
36
|
}
|
|
52
|
-
/**
|
|
53
|
-
* 监听设备方向变化事件。频率根据 Taro.startDeviceMotionListening() 的 interval 参数。可以使用 Taro.stopDeviceMotionListening() 停止监听。
|
|
54
|
-
* @supported weapp, h5, rn
|
|
55
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html
|
|
56
|
-
*/
|
|
57
|
-
function onDeviceMotionChange (callback: onDeviceMotionChange.Callback): void
|
|
58
37
|
|
|
59
38
|
namespace onDeviceMotionChange {
|
|
60
39
|
/** 设备方向变化事件的回调函数 */
|
|
@@ -70,12 +49,38 @@ declare namespace Taro {
|
|
|
70
49
|
}
|
|
71
50
|
}
|
|
72
51
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
52
|
+
interface TaroStatic {
|
|
53
|
+
/** 开始监听设备方向的变化。
|
|
54
|
+
* @supported weapp, h5, rn
|
|
55
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html
|
|
56
|
+
*/
|
|
57
|
+
startDeviceMotionListening(
|
|
58
|
+
option: startDeviceMotionListening.Option,
|
|
59
|
+
): void
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 停止监听设备方向的变化。
|
|
63
|
+
* @supported weapp, h5, rn
|
|
64
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html
|
|
65
|
+
*/
|
|
66
|
+
stopDeviceMotionListening(
|
|
67
|
+
option?: stopDeviceMotionListening.Option,
|
|
68
|
+
): void
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 监听设备方向变化事件。频率根据 Taro.startDeviceMotionListening() 的 interval 参数。可以使用 Taro.stopDeviceMotionListening() 停止监听。
|
|
72
|
+
* @supported weapp, h5, rn
|
|
73
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html
|
|
74
|
+
*/
|
|
75
|
+
onDeviceMotionChange (callback: onDeviceMotionChange.Callback): void
|
|
76
|
+
|
|
77
|
+
/** 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
|
|
78
|
+
* @supported weapp, rn
|
|
79
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html
|
|
80
|
+
*/
|
|
81
|
+
offDeviceMotionChange(
|
|
82
|
+
/** 设备方向变化事件的回调函数 */
|
|
83
|
+
callback?: (...args: any[]) => any,
|
|
84
|
+
): void
|
|
85
|
+
}
|
|
81
86
|
}
|