@tarojs/taro 3.4.1 → 3.4.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.
- package/package.json +5 -5
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +46 -23
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +150 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +8 -8
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +61 -32
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +45 -16
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -25
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +125 -37
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +111 -107
- package/types/compile.d.ts +5 -0
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -1,82 +1,106 @@
|
|
|
1
1
|
import Taro from '../../index'
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
|
+
namespace chooseContact {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (result: SuccessCallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
14
|
+
/** 手机号 */
|
|
15
|
+
phoneNumber: string
|
|
16
|
+
/** 联系人姓名 */
|
|
17
|
+
displayName: string
|
|
18
|
+
/** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */
|
|
19
|
+
phoneNumberList: string
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
4
23
|
namespace addPhoneContact {
|
|
5
24
|
interface Option {
|
|
6
25
|
/** 名字 */
|
|
7
26
|
firstName: string
|
|
8
|
-
/**
|
|
9
|
-
|
|
27
|
+
/** 头像本地文件路径 */
|
|
28
|
+
photoFilePath?: string
|
|
29
|
+
/** 昵称 */
|
|
30
|
+
nickName?: string
|
|
31
|
+
/** 中间名 */
|
|
32
|
+
middleName?: string
|
|
33
|
+
/** 姓氏 */
|
|
34
|
+
lastName?: string
|
|
35
|
+
/** 备注 */
|
|
36
|
+
remark?: string
|
|
37
|
+
/** 手机号 */
|
|
38
|
+
mobilePhoneNumber?: string
|
|
39
|
+
/** 微信号 */
|
|
40
|
+
weChatNumber?: string
|
|
10
41
|
/** 联系地址国家 */
|
|
11
42
|
addressCountry?: string
|
|
12
|
-
/** 联系地址邮政编码 */
|
|
13
|
-
addressPostalCode?: string
|
|
14
43
|
/** 联系地址省份 */
|
|
15
44
|
addressState?: string
|
|
45
|
+
/** 联系地址城市 */
|
|
46
|
+
addressCity?: string
|
|
16
47
|
/** 联系地址街道 */
|
|
17
48
|
addressStreet?: string
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/** 电子邮件 */
|
|
21
|
-
email?: string
|
|
22
|
-
/** 接口调用失败的回调函数 */
|
|
23
|
-
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
24
|
-
/** 住宅地址城市 */
|
|
25
|
-
homeAddressCity?: string
|
|
26
|
-
/** 住宅地址国家 */
|
|
27
|
-
homeAddressCountry?: string
|
|
28
|
-
/** 住宅地址邮政编码 */
|
|
29
|
-
homeAddressPostalCode?: string
|
|
30
|
-
/** 住宅地址省份 */
|
|
31
|
-
homeAddressState?: string
|
|
32
|
-
/** 住宅地址街道 */
|
|
33
|
-
homeAddressStreet?: string
|
|
34
|
-
/** 住宅传真 */
|
|
35
|
-
homeFaxNumber?: string
|
|
36
|
-
/** 住宅电话 */
|
|
37
|
-
homePhoneNumber?: string
|
|
38
|
-
/** 公司电话 */
|
|
39
|
-
hostNumber?: string
|
|
40
|
-
/** 姓氏 */
|
|
41
|
-
lastName?: string
|
|
42
|
-
/** 中间名 */
|
|
43
|
-
middleName?: string
|
|
44
|
-
/** 手机号 */
|
|
45
|
-
mobilePhoneNumber?: string
|
|
46
|
-
/** 昵称 */
|
|
47
|
-
nickName?: string
|
|
49
|
+
/** 联系地址邮政编码 */
|
|
50
|
+
addressPostalCode?: string
|
|
48
51
|
/** 公司 */
|
|
49
52
|
organization?: string
|
|
50
|
-
/** 头像本地文件路径 */
|
|
51
|
-
photoFilePath?: string
|
|
52
|
-
/** 备注 */
|
|
53
|
-
remark?: string
|
|
54
|
-
/** 接口调用成功的回调函数 */
|
|
55
|
-
success?: (res: TaroGeneral.CallbackResult) => void
|
|
56
53
|
/** 职位 */
|
|
57
54
|
title?: string
|
|
55
|
+
/** 工作传真 */
|
|
56
|
+
workFaxNumber?: string
|
|
57
|
+
/** 工作电话 */
|
|
58
|
+
workPhoneNumber?: string
|
|
59
|
+
/** 公司电话 */
|
|
60
|
+
hostNumber?: string
|
|
61
|
+
/** 电子邮件 */
|
|
62
|
+
email?: string
|
|
58
63
|
/** 网站 */
|
|
59
64
|
url?: string
|
|
60
|
-
/** 微信号 */
|
|
61
|
-
weChatNumber?: string
|
|
62
|
-
/** 工作地址城市 */
|
|
63
|
-
workAddressCity?: string
|
|
64
65
|
/** 工作地址国家 */
|
|
65
66
|
workAddressCountry?: string
|
|
66
|
-
/** 工作地址邮政编码 */
|
|
67
|
-
workAddressPostalCode?: string
|
|
68
67
|
/** 工作地址省份 */
|
|
69
68
|
workAddressState?: string
|
|
69
|
+
/** 工作地址城市 */
|
|
70
|
+
workAddressCity?: string
|
|
70
71
|
/** 工作地址街道 */
|
|
71
72
|
workAddressStreet?: string
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
73
|
+
/** 工作地址邮政编码 */
|
|
74
|
+
workAddressPostalCode?: string
|
|
75
|
+
/** 住宅传真 */
|
|
76
|
+
homeFaxNumber?: string
|
|
77
|
+
/** 住宅电话 */
|
|
78
|
+
homePhoneNumber?: string
|
|
79
|
+
/** 住宅地址国家 */
|
|
80
|
+
homeAddressCountry?: string
|
|
81
|
+
/** 住宅地址省份 */
|
|
82
|
+
homeAddressState?: string
|
|
83
|
+
/** 住宅地址城市 */
|
|
84
|
+
homeAddressCity?: string
|
|
85
|
+
/** 住宅地址街道 */
|
|
86
|
+
homeAddressStreet?: string
|
|
87
|
+
/** 住宅地址邮政编码 */
|
|
88
|
+
homeAddressPostalCode?: string
|
|
89
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
90
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
91
|
+
/** 接口调用失败的回调函数 */
|
|
92
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
93
|
+
/** 接口调用成功的回调函数 */
|
|
94
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
76
95
|
}
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
interface TaroStatic {
|
|
99
|
+
/** 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
|
|
100
|
+
* @supported weapp
|
|
101
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html
|
|
102
|
+
*/
|
|
103
|
+
chooseContact(option: chooseContact.Option): Promise<TaroGeneral.CallbackResult>
|
|
80
104
|
/** 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
|
|
81
105
|
* @supported weapp
|
|
82
106
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html
|
|
@@ -20,13 +20,13 @@ declare module '../../index' {
|
|
|
20
20
|
/** 接口调用失败的回调函数 */
|
|
21
21
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
22
22
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
23
|
-
interval?: keyof
|
|
23
|
+
interval?: keyof Interval
|
|
24
24
|
/** 接口调用成功的回调函数 */
|
|
25
25
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
|
29
|
-
interface
|
|
29
|
+
interface Interval {
|
|
30
30
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
31
31
|
game
|
|
32
32
|
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
|
@@ -53,19 +53,19 @@ declare module '../../index' {
|
|
|
53
53
|
|
|
54
54
|
interface TaroStatic {
|
|
55
55
|
/** 停止监听陀螺仪数据。
|
|
56
|
-
* @supported weapp
|
|
56
|
+
* @supported weapp, 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>
|
|
60
60
|
|
|
61
61
|
/** 开始监听陀螺仪数据。
|
|
62
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp, rn
|
|
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, rn
|
|
69
69
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
70
70
|
*/
|
|
71
71
|
onGyroscopeChange(
|
|
@@ -70,18 +70,32 @@ declare module '../../index' {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
interface IBeaconInfo {
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/**
|
|
73
|
+
/** Beacon 设备广播的 uuid */
|
|
74
|
+
uuid: string
|
|
75
|
+
/** Beacon 设备的主 ID */
|
|
76
76
|
major: string
|
|
77
|
-
/**
|
|
77
|
+
/** Beacon 设备的次 ID */
|
|
78
78
|
minor: string
|
|
79
|
-
/**
|
|
80
|
-
proximity:
|
|
81
|
-
/**
|
|
79
|
+
/** 表示设备距离的枚举值(仅iOS) */
|
|
80
|
+
proximity: keyof IBeaconInfo.Proximity
|
|
81
|
+
/** Beacon 设备的距离,单位 m。iOS 上,proximity 为 0 时,accuracy 为 -1。 */
|
|
82
|
+
accuracy: number
|
|
83
|
+
/** 表示设备的信号强度,单位 dBm */
|
|
82
84
|
rssi: number
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
namespace IBeaconInfo {
|
|
88
|
+
/** proximity 的合法值 */
|
|
89
|
+
interface Proximity {
|
|
90
|
+
/** 信号太弱不足以计算距离,或非 iOS 设备 */
|
|
91
|
+
0
|
|
92
|
+
/** 十分近 */
|
|
93
|
+
1
|
|
94
|
+
/** 比较近 */
|
|
95
|
+
2
|
|
96
|
+
/** 远 */
|
|
97
|
+
3
|
|
98
|
+
}
|
|
85
99
|
}
|
|
86
100
|
|
|
87
101
|
interface TaroStatic {
|
|
@@ -93,7 +107,7 @@ declare module '../../index' {
|
|
|
93
107
|
* ```
|
|
94
108
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html
|
|
95
109
|
*/
|
|
96
|
-
stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.
|
|
110
|
+
stopBeaconDiscovery(option?: stopBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
97
111
|
|
|
98
112
|
/** 开始搜索附近的 iBeacon 设备
|
|
99
113
|
* @supported weapp
|
|
@@ -105,7 +119,7 @@ declare module '../../index' {
|
|
|
105
119
|
* ```
|
|
106
120
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html
|
|
107
121
|
*/
|
|
108
|
-
startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.
|
|
122
|
+
startBeaconDiscovery(option: startBeaconDiscovery.Option): Promise<TaroGeneral.IBeaconError>
|
|
109
123
|
|
|
110
124
|
/** 监听 iBeacon 设备更新事件,仅能注册一个监听
|
|
111
125
|
* @supported weapp
|
|
@@ -125,19 +139,13 @@ declare module '../../index' {
|
|
|
125
139
|
callback: onBeaconServiceChange.Callback,
|
|
126
140
|
): void
|
|
127
141
|
|
|
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
142
|
/** 取消监听 iBeacon 设备更新事件
|
|
135
143
|
* @supported weapp
|
|
136
144
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html
|
|
137
145
|
*/
|
|
138
146
|
offBeaconUpdate(
|
|
139
147
|
/** iBeacon 设备更新事件的回调函数 */
|
|
140
|
-
callback: (res: TaroGeneral.
|
|
148
|
+
callback: (res: TaroGeneral.IBeaconError) => void,
|
|
141
149
|
): void
|
|
142
150
|
|
|
143
151
|
/** 取消监听 iBeacon 服务状态变化事件
|
|
@@ -146,7 +154,13 @@ declare module '../../index' {
|
|
|
146
154
|
*/
|
|
147
155
|
offBeaconServiceChange(
|
|
148
156
|
/** iBeacon 服务状态变化事件的回调函数 */
|
|
149
|
-
callback: (res: TaroGeneral.
|
|
157
|
+
callback: (res: TaroGeneral.IBeaconError) => void,
|
|
150
158
|
): void
|
|
159
|
+
|
|
160
|
+
/** 获取所有已搜索到的 iBeacon 设备
|
|
161
|
+
* @supported weapp
|
|
162
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html
|
|
163
|
+
*/
|
|
164
|
+
getBeacons(option?: getBeacons.Option): Promise<getBeacons.CallbackResult>
|
|
151
165
|
}
|
|
152
166
|
}
|
|
File without changes
|
|
@@ -9,10 +9,10 @@ declare module '../../index' {
|
|
|
9
9
|
|
|
10
10
|
interface CallbackResult {
|
|
11
11
|
/** 内存告警等级,只有 Android 才有,对应系统宏定义 */
|
|
12
|
-
level: keyof
|
|
12
|
+
level: keyof Level
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
interface
|
|
15
|
+
interface Level {
|
|
16
16
|
/** TRIM_MEMORY_RUNNING_MODERATE */
|
|
17
17
|
5
|
|
18
18
|
/** TRIM_MEMORY_RUNNING_LOW */
|
|
@@ -46,8 +46,8 @@ declare module '../../index' {
|
|
|
46
46
|
*/
|
|
47
47
|
offMemoryWarning(
|
|
48
48
|
/** 取消监听内存不足告警事件 */
|
|
49
|
-
callback:
|
|
49
|
+
callback: onMemoryWarning.Callback,
|
|
50
50
|
): void
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -10,11 +10,11 @@ declare module '../../index' {
|
|
|
10
10
|
/** 监听设备方向的变化回调函数的执行频率
|
|
11
11
|
* @default "normal"
|
|
12
12
|
*/
|
|
13
|
-
interval?: keyof
|
|
13
|
+
interval?: keyof Interval
|
|
14
14
|
/** 接口调用成功的回调函数 */
|
|
15
15
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
16
16
|
}
|
|
17
|
-
interface
|
|
17
|
+
interface Interval {
|
|
18
18
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
|
19
19
|
game
|
|
20
20
|
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
|
@@ -75,7 +75,7 @@ declare module '../../index' {
|
|
|
75
75
|
onDeviceMotionChange (callback: onDeviceMotionChange.Callback): void
|
|
76
76
|
|
|
77
77
|
/** 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
|
|
78
|
-
* @supported weapp, rn
|
|
78
|
+
* @supported weapp, h5, rn
|
|
79
79
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html
|
|
80
80
|
*/
|
|
81
81
|
offDeviceMotionChange(
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import Taro from '../../index'
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
|
+
namespace onNetworkWeakChange {
|
|
5
|
+
/** 弱网状态变化事件的回调函数 */
|
|
6
|
+
type Callback = (
|
|
7
|
+
result: CallbackResult,
|
|
8
|
+
) => void
|
|
9
|
+
|
|
10
|
+
interface CallbackResult {
|
|
11
|
+
/** 当前是否处于弱网状态 */
|
|
12
|
+
weakNet: boolean
|
|
13
|
+
/** 当前网络类型 */
|
|
14
|
+
networkType: keyof getNetworkType.NetworkType
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
namespace onNetworkStatusChange {
|
|
5
19
|
/** 网络状态变化事件的回调函数 */
|
|
6
20
|
type Callback = (
|
|
@@ -11,7 +25,7 @@ declare module '../../index' {
|
|
|
11
25
|
/** 当前是否有网络连接 */
|
|
12
26
|
isConnected: boolean
|
|
13
27
|
/** 网络类型 */
|
|
14
|
-
networkType: keyof getNetworkType.
|
|
28
|
+
networkType: keyof getNetworkType.NetworkType
|
|
15
29
|
}
|
|
16
30
|
}
|
|
17
31
|
|
|
@@ -26,13 +40,13 @@ declare module '../../index' {
|
|
|
26
40
|
}
|
|
27
41
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
28
42
|
/** 网络类型 */
|
|
29
|
-
networkType: keyof
|
|
43
|
+
networkType: keyof NetworkType
|
|
30
44
|
/** 调用结果 */
|
|
31
45
|
errMsg: string
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
/** 网络类型 */
|
|
35
|
-
interface
|
|
49
|
+
interface NetworkType {
|
|
36
50
|
/** wifi 网络 */
|
|
37
51
|
wifi
|
|
38
52
|
/** 2g 网络 */
|
|
@@ -68,6 +82,24 @@ declare module '../../index' {
|
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
interface TaroStatic {
|
|
85
|
+
/** 监听弱网状态变化事件
|
|
86
|
+
* @supported weapp
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* Taro.onNetworkWeakChange(function (res) {
|
|
90
|
+
* console.log(res.weakNet)
|
|
91
|
+
* console.log(res.networkType)
|
|
92
|
+
* })
|
|
93
|
+
* // 取消监听
|
|
94
|
+
* Taro.offNetworkWeakChange()
|
|
95
|
+
* ```
|
|
96
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html
|
|
97
|
+
*/
|
|
98
|
+
onNetworkWeakChange(
|
|
99
|
+
/** 弱网状态变化事件的回调函数 */
|
|
100
|
+
callback: onNetworkWeakChange.Callback,
|
|
101
|
+
): void
|
|
102
|
+
|
|
71
103
|
/** 监听网络状态变化。
|
|
72
104
|
* @supported weapp, h5, rn
|
|
73
105
|
* @example
|
|
@@ -84,6 +116,24 @@ declare module '../../index' {
|
|
|
84
116
|
callback: onNetworkStatusChange.Callback,
|
|
85
117
|
): void
|
|
86
118
|
|
|
119
|
+
/** 取消监听弱网状态变化事件
|
|
120
|
+
* @supported weapp
|
|
121
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html
|
|
122
|
+
*/
|
|
123
|
+
offNetworkWeakChange(
|
|
124
|
+
/** 弱网状态变化事件的回调函数 */
|
|
125
|
+
callback: onNetworkWeakChange.Callback,
|
|
126
|
+
): void
|
|
127
|
+
|
|
128
|
+
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
|
|
129
|
+
* @supported weapp, h5, rn
|
|
130
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
|
|
131
|
+
*/
|
|
132
|
+
offNetworkStatusChange(
|
|
133
|
+
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
|
|
134
|
+
callback?: onNetworkStatusChange.Callback,
|
|
135
|
+
): void
|
|
136
|
+
|
|
87
137
|
/** 获取网络类型。
|
|
88
138
|
* @supported weapp, h5, rn
|
|
89
139
|
* @example
|
|
@@ -100,15 +150,6 @@ declare module '../../index' {
|
|
|
100
150
|
*/
|
|
101
151
|
getNetworkType(option?: getNetworkType.Option): Promise<getNetworkType.SuccessCallbackResult>
|
|
102
152
|
|
|
103
|
-
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
|
|
104
|
-
* @supported weapp
|
|
105
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
|
|
106
|
-
*/
|
|
107
|
-
offNetworkStatusChange(
|
|
108
|
-
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
|
|
109
|
-
callback?: (...args: any[]) => any,
|
|
110
|
-
): void
|
|
111
|
-
|
|
112
153
|
/** 获取局域网IP地址。
|
|
113
154
|
* @supported weapp
|
|
114
155
|
* @example
|