@tarojs/taro 3.6.16 → 3.6.18
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 +4 -4
- package/types/api/ai/visionkit.d.ts +625 -54
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/canvas/index.d.ts +12 -2
- package/types/api/device/accelerometer.d.ts +8 -6
- 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 +40 -17
- package/types/api/device/bluetooth-peripheral.d.ts +26 -26
- package/types/api/device/bluetooth.d.ts +37 -13
- package/types/api/device/calendar.d.ts +11 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +5 -5
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +10 -8
- package/types/api/device/keyboard.d.ts +7 -5
- package/types/api/device/memory.d.ts +3 -4
- package/types/api/device/motion.d.ts +8 -6
- package/types/api/device/network.d.ts +12 -6
- package/types/api/device/nfc.d.ts +13 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +5 -3
- package/types/api/device/screen.d.ts +27 -11
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +5 -5
- package/types/api/device/wifi.d.ts +25 -13
- package/types/api/open-api/login.d.ts +1 -1
- package/types/api/open-api/my-miniprogram.d.ts +2 -2
- package/types/api/open-api/privacy.d.ts +4 -4
- package/types/api/skyline/index.d.ts +59 -0
- package/types/api/storage/cache-manager.d.ts +10 -10
- package/types/compile/config/util.d.ts +1 -1
- package/types/global.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/taro.api.d.ts +2 -0
- package/types/taro.config.d.ts +29 -4
|
@@ -7,7 +7,9 @@ declare module '../../index' {
|
|
|
7
7
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
8
|
/** 接口调用失败的回调函数 */
|
|
9
9
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
-
/** 是否只能从相机扫码,不允许从相册选择图片
|
|
10
|
+
/** 是否只能从相机扫码,不允许从相册选择图片
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
11
13
|
onlyFromCamera?: boolean
|
|
12
14
|
/** 扫码类型 */
|
|
13
15
|
scanType?: (keyof ScanType)[]
|
|
@@ -85,7 +87,7 @@ declare module '../../index' {
|
|
|
85
87
|
interface TaroStatic {
|
|
86
88
|
/**
|
|
87
89
|
* 调起客户端扫码界面,扫码成功后返回对应的结果
|
|
88
|
-
* @supported weapp,
|
|
90
|
+
* @supported weapp, swan, jd, qq, tt, h5, rn
|
|
89
91
|
* @example
|
|
90
92
|
* ```tsx
|
|
91
93
|
* // 允许从相机和相册扫码
|
|
@@ -94,7 +96,7 @@ declare module '../../index' {
|
|
|
94
96
|
* console.log(res)
|
|
95
97
|
* }
|
|
96
98
|
* })
|
|
97
|
-
*
|
|
99
|
+
* // 只允许从相机扫码
|
|
98
100
|
* Taro.scanCode({
|
|
99
101
|
* onlyFromCamera: true,
|
|
100
102
|
* success: (res) => {
|
|
@@ -77,10 +77,10 @@ declare module '../../index' {
|
|
|
77
77
|
success?: (option: SuccessCallbackResult) => void
|
|
78
78
|
}
|
|
79
79
|
interface ScreenRecordingState {
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
|
|
80
|
+
/** 开启 */
|
|
81
|
+
on
|
|
82
|
+
/** 关闭 */
|
|
83
|
+
off
|
|
84
84
|
}
|
|
85
85
|
interface SuccessCallbackResult {
|
|
86
86
|
/** 录屏状态 */
|
|
@@ -106,13 +106,13 @@ declare module '../../index' {
|
|
|
106
106
|
|
|
107
107
|
interface TaroStatic {
|
|
108
108
|
/** 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用
|
|
109
|
-
* @supported weapp
|
|
109
|
+
* @supported weapp, alipay
|
|
110
110
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setVisualEffectOnCapture.html
|
|
111
111
|
*/
|
|
112
112
|
setVisualEffectOnCapture(option: setVisualEffectOnCapture.Option): Promise<TaroGeneral.CallbackResult>
|
|
113
113
|
|
|
114
114
|
/** 设置屏幕亮度。
|
|
115
|
-
* @supported weapp,
|
|
115
|
+
* @supported weapp, swan, jd, qq, tt, rn
|
|
116
116
|
* @example
|
|
117
117
|
* ```tsx
|
|
118
118
|
* Taro.setScreenBrightness(params).then(...)
|
|
@@ -123,7 +123,7 @@ declare module '../../index' {
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
|
|
126
|
-
* @supported weapp,
|
|
126
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
127
127
|
* @example
|
|
128
128
|
* ```tsx
|
|
129
129
|
* // 保持屏幕常亮
|
|
@@ -137,7 +137,7 @@ declare module '../../index' {
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件
|
|
140
|
-
* @supported weapp, tt
|
|
140
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
141
141
|
* @example
|
|
142
142
|
* ```tsx
|
|
143
143
|
* Taro.onUserCaptureScreen(function (res) {
|
|
@@ -154,6 +154,14 @@ declare module '../../index' {
|
|
|
154
154
|
/** 监听用户录屏事件
|
|
155
155
|
* @supported weapp
|
|
156
156
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html
|
|
157
|
+
* @example
|
|
158
|
+
* ```tsx
|
|
159
|
+
* // 监听用户录屏事件
|
|
160
|
+
* const handler = function (res) {
|
|
161
|
+
* console.log(res.state)
|
|
162
|
+
* }
|
|
163
|
+
* Taro.onScreenRecordingStateChanged(handler)
|
|
164
|
+
* ```
|
|
157
165
|
*/
|
|
158
166
|
onScreenRecordingStateChanged(
|
|
159
167
|
/** 用户录屏事件的监听函数 */
|
|
@@ -161,7 +169,7 @@ declare module '../../index' {
|
|
|
161
169
|
): void
|
|
162
170
|
|
|
163
171
|
/** 用户主动截屏事件。取消事件监听。
|
|
164
|
-
* @supported weapp, tt
|
|
172
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
165
173
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
|
|
166
174
|
*/
|
|
167
175
|
offUserCaptureScreen(
|
|
@@ -175,12 +183,20 @@ declare module '../../index' {
|
|
|
175
183
|
*/
|
|
176
184
|
offScreenRecordingStateChanged(
|
|
177
185
|
/** 用户录屏事件的监听函数 */
|
|
178
|
-
callback
|
|
186
|
+
callback?: onScreenRecordingStateChanged.Callback
|
|
179
187
|
): void
|
|
180
188
|
|
|
181
189
|
/** 查询用户是否在录屏
|
|
182
190
|
* @supported weapp
|
|
183
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* Taro.getScreenRecordingState({
|
|
195
|
+
* success: function (res) {
|
|
196
|
+
* console.log(res.state)
|
|
197
|
+
* },
|
|
198
|
+
* })
|
|
199
|
+
* ```
|
|
184
200
|
*/
|
|
185
201
|
getScreenRecordingState(
|
|
186
202
|
option?: getScreenRecordingState.Option
|
|
@@ -191,7 +207,7 @@ declare module '../../index' {
|
|
|
191
207
|
*
|
|
192
208
|
* **说明**
|
|
193
209
|
* - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
|
|
194
|
-
* @supported weapp,
|
|
210
|
+
* @supported weapp, alipay, swan, jd, qq, rn
|
|
195
211
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html
|
|
196
212
|
*/
|
|
197
213
|
getScreenBrightness(
|
|
@@ -4,7 +4,7 @@ declare module '../../index' {
|
|
|
4
4
|
namespace vibrateShort {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 震动强度类型,有效值为:heavy、medium、light */
|
|
7
|
-
type
|
|
7
|
+
type?: 'heavy' | 'medium' | 'light'
|
|
8
8
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
9
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
10
|
/** 接口调用失败的回调函数 */
|
|
@@ -27,9 +27,9 @@ declare module '../../index' {
|
|
|
27
27
|
|
|
28
28
|
interface TaroStatic {
|
|
29
29
|
/** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @supported weapp,
|
|
30
|
+
*
|
|
31
|
+
* 仅微信小程序平台支持 type 参数
|
|
32
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
33
33
|
* @example
|
|
34
34
|
* ```tsx
|
|
35
35
|
* Taro.vibrateShort(params).then(...)
|
|
@@ -39,7 +39,7 @@ declare module '../../index' {
|
|
|
39
39
|
vibrateShort(option?: vibrateShort.Option): Promise<TaroGeneral.CallbackResult>
|
|
40
40
|
|
|
41
41
|
/** 使手机发生较长时间的振动(400ms)
|
|
42
|
-
* @supported weapp,
|
|
42
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
43
43
|
* @example
|
|
44
44
|
* ```tsx
|
|
45
45
|
* Taro.vibrateLong(params).then(...)
|
|
@@ -90,6 +90,10 @@ declare module '../../index' {
|
|
|
90
90
|
|
|
91
91
|
namespace getConnectedWifi {
|
|
92
92
|
interface Option {
|
|
93
|
+
/** 是否需要返回部分 Wi-Fi 信息
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
partialInfo?: boolean
|
|
93
97
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
94
98
|
complete?: (res: TaroGeneral.WifiError) => void
|
|
95
99
|
/** 接口调用失败的回调函数 */
|
|
@@ -113,6 +117,14 @@ declare module '../../index' {
|
|
|
113
117
|
password: string
|
|
114
118
|
/** Wi-Fi 设备 BSSID */
|
|
115
119
|
BSSID?: string
|
|
120
|
+
/** 跳转到系统设置页进行连接
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
maunal?: boolean
|
|
124
|
+
/** 是否需要返回部分 Wi-Fi 信息,仅安卓生效
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
partialInfo?: boolean
|
|
116
128
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
117
129
|
complete?: (res: TaroGeneral.WifiError) => void
|
|
118
130
|
/** 接口调用失败的回调函数 */
|
|
@@ -142,7 +154,7 @@ declare module '../../index' {
|
|
|
142
154
|
|
|
143
155
|
interface TaroStatic {
|
|
144
156
|
/** 关闭 Wi-Fi 模块。
|
|
145
|
-
* @supported weapp
|
|
157
|
+
* @supported weapp, alipay, swan, jd
|
|
146
158
|
* @example
|
|
147
159
|
* ```tsx
|
|
148
160
|
* Taro.stopWifi({
|
|
@@ -156,7 +168,7 @@ declare module '../../index' {
|
|
|
156
168
|
stopWifi(option?: stopWifi.Option): Promise<TaroGeneral.WifiError>
|
|
157
169
|
|
|
158
170
|
/** 初始化 Wi-Fi 模块。
|
|
159
|
-
* @supported weapp
|
|
171
|
+
* @supported weapp, alipay, swan, jd
|
|
160
172
|
* @example
|
|
161
173
|
* ```tsx
|
|
162
174
|
* Taro.startWifi({
|
|
@@ -175,7 +187,7 @@ declare module '../../index' {
|
|
|
175
187
|
* - 该接口只能在 `onGetWifiList` 回调之后才能调用。
|
|
176
188
|
* - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
|
|
177
189
|
* - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
|
|
178
|
-
* @supported weapp
|
|
190
|
+
* @supported weapp, swan, jd
|
|
179
191
|
* @example
|
|
180
192
|
* ```tsx
|
|
181
193
|
* Taro.onGetWifiList(function (res) {
|
|
@@ -209,7 +221,7 @@ declare module '../../index' {
|
|
|
209
221
|
): void
|
|
210
222
|
|
|
211
223
|
/** 监听连接上 Wi-Fi 的事件。
|
|
212
|
-
* @supported weapp
|
|
224
|
+
* @supported weapp, alipay, swan, jd
|
|
213
225
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html
|
|
214
226
|
*/
|
|
215
227
|
onWifiConnected(
|
|
@@ -218,7 +230,7 @@ declare module '../../index' {
|
|
|
218
230
|
): void
|
|
219
231
|
|
|
220
232
|
/** 监听获取到 Wi-Fi 列表数据事件
|
|
221
|
-
* @supported weapp, tt
|
|
233
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
222
234
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html
|
|
223
235
|
*/
|
|
224
236
|
onGetWifiList(
|
|
@@ -232,39 +244,39 @@ declare module '../../index' {
|
|
|
232
244
|
*/
|
|
233
245
|
offWifiConnectedWithPartialInfo(
|
|
234
246
|
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
235
|
-
callback
|
|
247
|
+
callback?: onWifiConnectedWithPartialInfo.Callback,
|
|
236
248
|
): void
|
|
237
249
|
|
|
238
250
|
/**
|
|
239
251
|
* 取消监听连接上 Wi-Fi 的事件。
|
|
240
|
-
* @supported weapp
|
|
252
|
+
* @supported weapp, alipay, swan, jd
|
|
241
253
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html
|
|
242
254
|
*/
|
|
243
255
|
offWifiConnected(
|
|
244
256
|
/** 连接上 Wi-Fi 的事件的回调函数 */
|
|
245
|
-
callback
|
|
257
|
+
callback?: onWifiConnected.Callback,
|
|
246
258
|
): void
|
|
247
259
|
|
|
248
260
|
/**
|
|
249
261
|
* 取消监听获取到 Wi-Fi 列表数据事件。
|
|
250
|
-
* @supported weapp, tt
|
|
262
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
251
263
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html
|
|
252
264
|
*/
|
|
253
265
|
offGetWifiList(
|
|
254
266
|
/** 获取到 Wi-Fi 列表数据事件的回调函数 */
|
|
255
|
-
callback
|
|
267
|
+
callback?: onGetWifiList.Callback,
|
|
256
268
|
): void
|
|
257
269
|
|
|
258
270
|
/** 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
|
|
259
271
|
*
|
|
260
272
|
* iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
|
|
261
|
-
* @supported weapp, tt
|
|
273
|
+
* @supported weapp, alipay, swan, jd, tt
|
|
262
274
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html
|
|
263
275
|
*/
|
|
264
276
|
getWifiList(option?: getWifiList.Option): Promise<TaroGeneral.WifiError>
|
|
265
277
|
|
|
266
278
|
/** 获取已连接中的 Wi-Fi 信息。
|
|
267
|
-
* @supported weapp
|
|
279
|
+
* @supported weapp, alipay, swan, tt
|
|
268
280
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html
|
|
269
281
|
*/
|
|
270
282
|
getConnectedWifi(option?: getConnectedWifi.Option): Promise<TaroGeneral.WifiError>
|
|
@@ -281,7 +293,7 @@ declare module '../../index' {
|
|
|
281
293
|
* }
|
|
282
294
|
* })
|
|
283
295
|
* ```
|
|
284
|
-
* @supported weapp
|
|
296
|
+
* @supported weapp, alipay, swan, jd
|
|
285
297
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html
|
|
286
298
|
*/
|
|
287
299
|
connectWifi(option: connectWifi.Option): Promise<TaroGeneral.WifiError>
|
|
@@ -81,7 +81,7 @@ declare module '../../index' {
|
|
|
81
81
|
*
|
|
82
82
|
* 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
|
|
83
83
|
*
|
|
84
|
-
* 登录态过期后开发者可以再调用 Taro.login
|
|
84
|
+
* 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
85
85
|
* @supported weapp
|
|
86
86
|
* @example
|
|
87
87
|
* ```tsx
|
|
@@ -8,7 +8,7 @@ declare module '../../index' {
|
|
|
8
8
|
/** 接口调用失败的回调函数 */
|
|
9
9
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
10
|
/** 接口调用成功的回调函数 */
|
|
11
|
-
success?: (res:
|
|
11
|
+
success?: (res: SuccessCallbackResult) => void
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
@@ -23,6 +23,6 @@ declare module '../../index' {
|
|
|
23
23
|
* @supported weapp
|
|
24
24
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
|
|
25
25
|
*/
|
|
26
|
-
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):
|
|
26
|
+
checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -76,24 +76,24 @@ declare module '../../index' {
|
|
|
76
76
|
* @supported weapp
|
|
77
77
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html
|
|
78
78
|
*/
|
|
79
|
-
getPrivacySetting
|
|
79
|
+
getPrivacySetting(option?: getPrivacySetting.Option): void
|
|
80
80
|
/**
|
|
81
81
|
* 跳转至隐私协议页面。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
82
82
|
* @supported weapp
|
|
83
83
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html
|
|
84
84
|
*/
|
|
85
|
-
openPrivacyContract
|
|
85
|
+
openPrivacyContract(option?: openPrivacyContract.Option): void
|
|
86
86
|
/**
|
|
87
87
|
* 模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
88
88
|
* @supported weapp
|
|
89
89
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html
|
|
90
90
|
*/
|
|
91
|
-
requirePrivacyAuthorize
|
|
91
|
+
requirePrivacyAuthorize(option?: requirePrivacyAuthorize.Option): void
|
|
92
92
|
/**
|
|
93
93
|
* 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见《小程序隐私协议开发指南》
|
|
94
94
|
* @supported weapp
|
|
95
95
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html
|
|
96
96
|
*/
|
|
97
|
-
onNeedPrivacyAuthorization
|
|
97
|
+
onNeedPrivacyAuthorization(listener: onNeedPrivacyAuthorization.Listener): void
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
/**
|
|
5
|
+
* Snapshot 实例,可通过 SelectorQuery 获取。
|
|
6
|
+
*
|
|
7
|
+
* Snapshot 通过 id 跟一个 snapshot 组件绑定,操作对应的 snapshot 组件。
|
|
8
|
+
* @supported weapp
|
|
9
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html
|
|
10
|
+
*/
|
|
11
|
+
interface Snapshot {
|
|
12
|
+
/**
|
|
13
|
+
* 画布宽度
|
|
14
|
+
*/
|
|
15
|
+
width: number
|
|
16
|
+
/**
|
|
17
|
+
* 画布高度
|
|
18
|
+
*/
|
|
19
|
+
height: number
|
|
20
|
+
/**
|
|
21
|
+
* 对 snapshot 组件子树进行截图
|
|
22
|
+
* @param option
|
|
23
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html
|
|
24
|
+
*/
|
|
25
|
+
takeSnapshot(option: Snapshot.TakeSnapshot.Option): Promise<TaroGeneral.CallbackResult>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
namespace Snapshot {
|
|
29
|
+
namespace TakeSnapshot {
|
|
30
|
+
interface Option {
|
|
31
|
+
/**
|
|
32
|
+
* 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file'
|
|
33
|
+
*/
|
|
34
|
+
type: string
|
|
35
|
+
/**
|
|
36
|
+
* 截图文件格式,'rgba' 或 'png',默认值为 'png'
|
|
37
|
+
*/
|
|
38
|
+
format: string
|
|
39
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
40
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
41
|
+
/** 接口调用失败的回调函数 */
|
|
42
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
43
|
+
/** 接口调用成功的回调函数 */
|
|
44
|
+
success?: (res: SuccessCallbackResult) => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface SuccessCallbackResult {
|
|
48
|
+
/**
|
|
49
|
+
* 截图保存的临时文件路径,当 type 为 file 该字段生效
|
|
50
|
+
*/
|
|
51
|
+
tempFilePath: string
|
|
52
|
+
/**
|
|
53
|
+
* 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效
|
|
54
|
+
*/
|
|
55
|
+
data: string
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -26,7 +26,7 @@ declare module '../../index' {
|
|
|
26
26
|
* @supported weapp
|
|
27
27
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html
|
|
28
28
|
*/
|
|
29
|
-
deleteCache(
|
|
29
|
+
deleteCache(
|
|
30
30
|
/** 缓存 id */
|
|
31
31
|
id: string
|
|
32
32
|
): void
|
|
@@ -40,7 +40,7 @@ declare module '../../index' {
|
|
|
40
40
|
): void
|
|
41
41
|
/** 删除规则,同时会删除对应规则下所有缓存
|
|
42
42
|
* @supported weapp
|
|
43
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
|
|
43
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
|
|
44
44
|
*/
|
|
45
45
|
deleteRule(
|
|
46
46
|
/** 规则 id */
|
|
@@ -67,17 +67,17 @@ declare module '../../index' {
|
|
|
67
67
|
/** 事件名称 */
|
|
68
68
|
eventName: string,
|
|
69
69
|
/** 事件监听函数 */
|
|
70
|
-
handler:
|
|
70
|
+
handler: TaroGeneral.EventCallback
|
|
71
71
|
): void
|
|
72
72
|
/** 监听事件
|
|
73
73
|
* @supported weapp
|
|
74
74
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html
|
|
75
75
|
*/
|
|
76
|
-
on(
|
|
76
|
+
on(
|
|
77
77
|
/** 事件名称 */
|
|
78
78
|
eventName: keyof CacheManager.OnEventName,
|
|
79
79
|
/** 事件监听函数 */
|
|
80
|
-
handler:
|
|
80
|
+
handler: TaroGeneral.EventCallback
|
|
81
81
|
): void
|
|
82
82
|
/** 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1
|
|
83
83
|
* @supported weapp
|
|
@@ -117,7 +117,7 @@ declare module '../../index' {
|
|
|
117
117
|
method: string
|
|
118
118
|
/** uri 匹配规则,可参考规则字符串写法和正则写法 */
|
|
119
119
|
url: any
|
|
120
|
-
/**
|
|
120
|
+
/**
|
|
121
121
|
* 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间
|
|
122
122
|
* @default 7 * 24 * 60 * 60 * 1000
|
|
123
123
|
*/
|
|
@@ -189,10 +189,10 @@ declare module '../../index' {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
interface TaroStatic {
|
|
192
|
-
/**
|
|
193
|
-
* @supported
|
|
194
|
-
* @see
|
|
192
|
+
/** 创建缓存管理器
|
|
193
|
+
* @supported weapp
|
|
194
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html
|
|
195
195
|
*/
|
|
196
196
|
createCacheManager(option: createCacheManager.Option): CacheManager
|
|
197
197
|
}
|
|
198
|
-
}
|
|
198
|
+
}
|
package/types/global.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ declare namespace TaroGeneral {
|
|
|
2
2
|
type IAnyObject = Record<string, any>
|
|
3
3
|
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
|
|
4
4
|
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
|
|
5
|
+
type TFunc = (...args: any[]) => any
|
|
5
6
|
/** 事件监听函数 */
|
|
6
7
|
type EventCallback = (
|
|
7
8
|
/** 触发事件参数 */
|
package/types/index.d.ts
CHANGED
package/types/taro.api.d.ts
CHANGED
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
/// <reference path="api/open-api/subscribe-message.d.ts" />
|
|
73
73
|
/// <reference path="api/open-api/redpackage.d.ts" />
|
|
74
74
|
/// <reference path="api/open-api/favorites.d.ts" />
|
|
75
|
+
/// <reference path="api/open-api/my-miniprogram.d.ts" />
|
|
75
76
|
/// <reference path="api/open-api/license-plate.d.ts" />
|
|
76
77
|
/// <reference path="api/open-api/channels.d.ts" />
|
|
77
78
|
/// <reference path="api/open-api/device-voip.d.ts" />
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
/// <reference path="api/wxml/index.d.ts" />
|
|
109
110
|
/// <reference path="api/ext/index.d.ts" />
|
|
110
111
|
/// <reference path="api/ad/index.d.ts" />
|
|
112
|
+
/// <reference path="api/skyline/index.d.ts" />
|
|
111
113
|
|
|
112
114
|
/// <reference path="api/cloud/index.d.ts" />
|
|
113
115
|
/// <reference path="api/open-api/facial.d.ts" />
|
package/types/taro.config.d.ts
CHANGED
|
@@ -363,16 +363,41 @@ declare module './index' {
|
|
|
363
363
|
|
|
364
364
|
interface RenderOptions {
|
|
365
365
|
skyline: {
|
|
366
|
-
/**
|
|
367
|
-
* 开启默认Block布局
|
|
366
|
+
/** 开启默认Block布局
|
|
368
367
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/wxss.html#%E5%BC%80%E5%90%AF%E9%BB%98%E8%AE%A4Block%E5%B8%83%E5%B1%80
|
|
368
|
+
* @supported weapp
|
|
369
369
|
*/
|
|
370
370
|
defaultDisplayBlock?: boolean
|
|
371
|
-
/**
|
|
372
|
-
* 关闭 Skyline AB 实验
|
|
371
|
+
/** 关闭 Skyline AB 实验
|
|
373
372
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/release.html#%E5%8F%91%E5%B8%83%E4%B8%8A%E7%BA%BF
|
|
373
|
+
* @supported weapp
|
|
374
374
|
*/
|
|
375
375
|
disableABTest?: boolean
|
|
376
|
+
/** 基础库最低版本
|
|
377
|
+
* @supported weapp
|
|
378
|
+
*/
|
|
379
|
+
sdkVersionBegin?: string
|
|
380
|
+
/** 基础库最高版本
|
|
381
|
+
* @supported weapp
|
|
382
|
+
*/
|
|
383
|
+
sdkVersionEnd?: string
|
|
384
|
+
/** iOS 微信最低版本
|
|
385
|
+
* @supported weapp
|
|
386
|
+
*/
|
|
387
|
+
iosVersionBegin?: string
|
|
388
|
+
/** iOS 微信最高版本
|
|
389
|
+
* @supported weapp
|
|
390
|
+
*/
|
|
391
|
+
iosVersionEnd?: string
|
|
392
|
+
/** 安卓微信最低版本
|
|
393
|
+
* @supported weapp
|
|
394
|
+
*/
|
|
395
|
+
androidVersionBegin?: string
|
|
396
|
+
/** 安卓微信最高版本
|
|
397
|
+
* @supported weapp
|
|
398
|
+
*/
|
|
399
|
+
androidVersionEnd?: string
|
|
400
|
+
[key: string]: unknown
|
|
376
401
|
}
|
|
377
402
|
}
|
|
378
403
|
|