@spcsn/taro 0.1.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 +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopWifi {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.WifiError) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace startWifi {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
18
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
19
|
+
/** 接口调用失败的回调函数 */
|
|
20
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
21
|
+
/** 接口调用成功的回调函数 */
|
|
22
|
+
success?: (res: TaroGeneral.WifiError) => void
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
namespace setWifiList {
|
|
27
|
+
interface Option {
|
|
28
|
+
/** 提供预设的 Wi-Fi 信息列表 */
|
|
29
|
+
wifiList: WifiData[]
|
|
30
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
31
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
32
|
+
/** 接口调用失败的回调函数 */
|
|
33
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
34
|
+
/** 接口调用成功的回调函数 */
|
|
35
|
+
success?: (res: TaroGeneral.WifiError) => void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 提供预设的 Wi-Fi 信息列表 */
|
|
39
|
+
interface WifiData {
|
|
40
|
+
/** Wi-Fi 的 BSSID */
|
|
41
|
+
BSSID?: string
|
|
42
|
+
/** Wi-Fi 的 SSID */
|
|
43
|
+
SSID?: string
|
|
44
|
+
/** Wi-Fi 设备密码 */
|
|
45
|
+
password?: string
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
namespace onWifiConnectedWithPartialInfo {
|
|
50
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
51
|
+
type Callback = (
|
|
52
|
+
result: CallbackResult,
|
|
53
|
+
) => void
|
|
54
|
+
interface CallbackResult {
|
|
55
|
+
/** 只包含 SSID 属性的 WifiInfo 对象 */
|
|
56
|
+
wifi: Pick<WifiInfo, 'SSID'>
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
namespace onWifiConnected {
|
|
61
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
62
|
+
type Callback = (
|
|
63
|
+
result: CallbackResult,
|
|
64
|
+
) => void
|
|
65
|
+
interface CallbackResult {
|
|
66
|
+
/** Wi-Fi 信息 */
|
|
67
|
+
wifi: WifiInfo
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
namespace onGetWifiList {
|
|
72
|
+
/** 获取到 Wi-Fi 列表数据事件的回调函数 */
|
|
73
|
+
type Callback = (result: CallbackResult) => void
|
|
74
|
+
interface CallbackResult {
|
|
75
|
+
/** Wi-Fi 列表数据 */
|
|
76
|
+
wifiList: WifiInfo[]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
namespace getWifiList {
|
|
81
|
+
interface Option {
|
|
82
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
83
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
84
|
+
/** 接口调用失败的回调函数 */
|
|
85
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
86
|
+
/** 接口调用成功的回调函数 */
|
|
87
|
+
success?: (res: TaroGeneral.WifiError) => void
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
namespace getConnectedWifi {
|
|
92
|
+
interface Option {
|
|
93
|
+
/** 是否需要返回部分 Wi-Fi 信息
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
partialInfo?: boolean
|
|
97
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
98
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
99
|
+
/** 接口调用失败的回调函数 */
|
|
100
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
101
|
+
/** 接口调用成功的回调函数 */
|
|
102
|
+
success?: (result: SuccessCallbackResult) => void
|
|
103
|
+
}
|
|
104
|
+
interface SuccessCallbackResult extends TaroGeneral.WifiError {
|
|
105
|
+
/** Wi-Fi 信息 */
|
|
106
|
+
wifi: WifiInfo
|
|
107
|
+
/** 调用结果 */
|
|
108
|
+
errMsg: string
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
namespace connectWifi {
|
|
113
|
+
interface Option {
|
|
114
|
+
/** Wi-Fi 设备 SSID */
|
|
115
|
+
SSID: string
|
|
116
|
+
/** Wi-Fi 设备密码 */
|
|
117
|
+
password: string
|
|
118
|
+
/** Wi-Fi 设备 BSSID */
|
|
119
|
+
BSSID?: string
|
|
120
|
+
/** 跳转到系统设置页进行连接
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
maunal?: boolean
|
|
124
|
+
/** 是否需要返回部分 Wi-Fi 信息,仅安卓生效
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
partialInfo?: boolean
|
|
128
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
129
|
+
complete?: (res: TaroGeneral.WifiError) => void
|
|
130
|
+
/** 接口调用失败的回调函数 */
|
|
131
|
+
fail?: (res: TaroGeneral.WifiError) => void
|
|
132
|
+
/** 接口调用成功的回调函数 */
|
|
133
|
+
success?: (res: TaroGeneral.WifiError) => void
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Wifi 信息
|
|
138
|
+
*
|
|
139
|
+
* 注意:
|
|
140
|
+
* 安卓 Taro.connectWifi / Taro.getConnectedWifi 若设置了 partialInfo:true ,或者调用了 Taro.onWifiConnectedWithPartialInfo 事件。将会返回只包含 SSID 属性的 WifiInfo 对象。 在某些情况下,可能 Wi-Fi 已经连接成功,但会因为获取不到完整的 WifiInfo 对象报错。具体错误信息为 errCode: 12010, errMsg: can't gain current wifi 。如果开发者不需要完整的 WifiInfo 对象,则可以通过采取上述策略解决报错问题。
|
|
141
|
+
*/
|
|
142
|
+
interface WifiInfo {
|
|
143
|
+
/** Wi-Fi 的 SSID */
|
|
144
|
+
SSID: string
|
|
145
|
+
/** Wi-Fi 的 BSSID */
|
|
146
|
+
BSSID: string
|
|
147
|
+
/** Wi-Fi 是否安全 */
|
|
148
|
+
secure: boolean
|
|
149
|
+
/** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
|
|
150
|
+
signalStrength: number
|
|
151
|
+
/** Wi-Fi 频段单位 MHz */
|
|
152
|
+
frequency?: number
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface TaroStatic {
|
|
156
|
+
/** 关闭 Wi-Fi 模块。
|
|
157
|
+
* @supported weapp, alipay, swan, jd
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* Taro.stopWifi({
|
|
161
|
+
* success: function (res) {
|
|
162
|
+
* console.log(res.errMsg)
|
|
163
|
+
* }
|
|
164
|
+
* })
|
|
165
|
+
* ```
|
|
166
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html
|
|
167
|
+
*/
|
|
168
|
+
stopWifi(option?: stopWifi.Option): Promise<TaroGeneral.WifiError>
|
|
169
|
+
|
|
170
|
+
/** 初始化 Wi-Fi 模块。
|
|
171
|
+
* @supported weapp, alipay, swan, jd
|
|
172
|
+
* @example
|
|
173
|
+
* ```tsx
|
|
174
|
+
* Taro.startWifi({
|
|
175
|
+
* success: function (res) {
|
|
176
|
+
* console.log(res.errMsg)
|
|
177
|
+
* }
|
|
178
|
+
* })
|
|
179
|
+
* ```
|
|
180
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html
|
|
181
|
+
*/
|
|
182
|
+
startWifi(option?: startWifi.Option): Promise<TaroGeneral.WifiError>
|
|
183
|
+
|
|
184
|
+
/** 设置 `wifiList` 中 AP 的相关信息。在 `onGetWifiList` 回调后调用,**iOS特有接口**。
|
|
185
|
+
*
|
|
186
|
+
* **注意**
|
|
187
|
+
* - 该接口只能在 `onGetWifiList` 回调之后才能调用。
|
|
188
|
+
* - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
|
|
189
|
+
* - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
|
|
190
|
+
* @supported weapp, swan, jd
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* Taro.onGetWifiList(function (res) {
|
|
194
|
+
* if (res.wifiList.length) {
|
|
195
|
+
* Taro.setWifiList({
|
|
196
|
+
* wifiList: [{
|
|
197
|
+
* SSID: res.wifiList[0].SSID,
|
|
198
|
+
* BSSID: res.wifiList[0].BSSID,
|
|
199
|
+
* password: '123456'
|
|
200
|
+
* }]
|
|
201
|
+
* })
|
|
202
|
+
* } else {
|
|
203
|
+
* Taro.setWifiList({
|
|
204
|
+
* wifiList: []
|
|
205
|
+
* })
|
|
206
|
+
* }
|
|
207
|
+
* })
|
|
208
|
+
* Taro.getWifiList()
|
|
209
|
+
* ```
|
|
210
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html
|
|
211
|
+
*/
|
|
212
|
+
setWifiList(option: setWifiList.Option): Promise<TaroGeneral.WifiError>
|
|
213
|
+
|
|
214
|
+
/** 监听连接上 Wi-Fi 的事件
|
|
215
|
+
* @supported weapp
|
|
216
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnectedWithPartialInfo.html
|
|
217
|
+
*/
|
|
218
|
+
onWifiConnectedWithPartialInfo(
|
|
219
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
220
|
+
callback: onWifiConnectedWithPartialInfo.Callback,
|
|
221
|
+
): void
|
|
222
|
+
|
|
223
|
+
/** 监听连接上 Wi-Fi 的事件。
|
|
224
|
+
* @supported weapp, alipay, swan, jd
|
|
225
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html
|
|
226
|
+
*/
|
|
227
|
+
onWifiConnected(
|
|
228
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
229
|
+
callback: onWifiConnected.Callback,
|
|
230
|
+
): void
|
|
231
|
+
|
|
232
|
+
/** 监听获取到 Wi-Fi 列表数据事件
|
|
233
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
234
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html
|
|
235
|
+
*/
|
|
236
|
+
onGetWifiList(
|
|
237
|
+
/** 获取到 Wi-Fi 列表数据事件的回调函数 */
|
|
238
|
+
callback: onGetWifiList.Callback,
|
|
239
|
+
): void
|
|
240
|
+
|
|
241
|
+
/** 取消监听连接上 Wi-Fi 的事件
|
|
242
|
+
* @supported weapp
|
|
243
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnectedWithPartialInfo.html
|
|
244
|
+
*/
|
|
245
|
+
offWifiConnectedWithPartialInfo(
|
|
246
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
247
|
+
callback?: onWifiConnectedWithPartialInfo.Callback,
|
|
248
|
+
): void
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 取消监听连接上 Wi-Fi 的事件。
|
|
252
|
+
* @supported weapp, alipay, swan, jd
|
|
253
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html
|
|
254
|
+
*/
|
|
255
|
+
offWifiConnected(
|
|
256
|
+
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
257
|
+
callback?: onWifiConnected.Callback,
|
|
258
|
+
): void
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* 取消监听获取到 Wi-Fi 列表数据事件。
|
|
262
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
263
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html
|
|
264
|
+
*/
|
|
265
|
+
offGetWifiList(
|
|
266
|
+
/** 获取到 Wi-Fi 列表数据事件的回调函数 */
|
|
267
|
+
callback?: onGetWifiList.Callback,
|
|
268
|
+
): void
|
|
269
|
+
|
|
270
|
+
/** 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
|
|
271
|
+
*
|
|
272
|
+
* iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
|
|
273
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
274
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html
|
|
275
|
+
*/
|
|
276
|
+
getWifiList(option?: getWifiList.Option): Promise<TaroGeneral.WifiError>
|
|
277
|
+
|
|
278
|
+
/** 获取已连接中的 Wi-Fi 信息。
|
|
279
|
+
* @supported weapp, alipay, swan, tt
|
|
280
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html
|
|
281
|
+
*/
|
|
282
|
+
getConnectedWifi(option?: getConnectedWifi.Option): Promise<TaroGeneral.WifiError>
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。
|
|
286
|
+
* @example
|
|
287
|
+
* ```tsx
|
|
288
|
+
* Taro.connectWifi({
|
|
289
|
+
* SSID: '',
|
|
290
|
+
* BSSID: '',
|
|
291
|
+
* success: function (res) {
|
|
292
|
+
* console.log(res.errMsg)
|
|
293
|
+
* }
|
|
294
|
+
* })
|
|
295
|
+
* ```
|
|
296
|
+
* @supported weapp, alipay, swan, jd
|
|
297
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html
|
|
298
|
+
*/
|
|
299
|
+
connectWifi(option: connectWifi.Option): Promise<TaroGeneral.WifiError>
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getExtConfigSync {
|
|
5
|
+
interface ExtInfo {
|
|
6
|
+
/** 第三方平台自定义的数据 */
|
|
7
|
+
extConfig: TaroGeneral.IAnyObject
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
namespace getExtConfig {
|
|
12
|
+
interface Option {
|
|
13
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
14
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
15
|
+
/** 接口调用失败的回调函数 */
|
|
16
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
17
|
+
/** 接口调用成功的回调函数 */
|
|
18
|
+
success?: (result: SuccessCallbackResult) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
22
|
+
/** 第三方平台自定义的数据 */
|
|
23
|
+
extConfig: TaroGeneral.IAnyObject
|
|
24
|
+
/** 调用结果 */
|
|
25
|
+
errMsg: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface TaroStatic {
|
|
30
|
+
/** Taro.getExtConfig 的同步版本。
|
|
31
|
+
*
|
|
32
|
+
* **Tips**
|
|
33
|
+
* 1. 本接口暂时无法通过 Taro.canIUse 判断是否兼容,开发者需要自行判断 Taro.getExtConfigSync 是否存在来兼容
|
|
34
|
+
* @supported weapp, tt
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* let extConfig = Taro.getExtConfigSync? Taro.getExtConfigSync(): {}
|
|
38
|
+
*
|
|
39
|
+
* console.log(extConfig)
|
|
40
|
+
* ```
|
|
41
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html
|
|
42
|
+
*/
|
|
43
|
+
getExtConfigSync(): TaroGeneral.IAnyObject
|
|
44
|
+
|
|
45
|
+
/** 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。
|
|
46
|
+
*
|
|
47
|
+
* **Tips**
|
|
48
|
+
* 1. 本接口暂时无法通过 Taro.canIUse 判断是否兼容,开发者需要自行判断 Taro.getExtConfig 是否存在来兼容
|
|
49
|
+
* @supported weapp, tt
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* if(Taro.getExtConfig) {
|
|
53
|
+
* Taro.getExtConfig({
|
|
54
|
+
* success: function (res) {
|
|
55
|
+
* console.log(res.extConfig)
|
|
56
|
+
* }
|
|
57
|
+
* })
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html
|
|
61
|
+
*/
|
|
62
|
+
getExtConfig(option?: getExtConfig.Option): Promise<getExtConfig.SuccessCallbackResult>
|
|
63
|
+
}
|
|
64
|
+
}
|