@tarojs/taro 3.6.9-alpha.4 → 3.6.9-alpha.6
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/inference.d.ts +133 -0
- package/types/api/base/performance.d.ts +63 -0
- package/types/api/base/system.d.ts +65 -0
- package/types/api/device/screen.d.ts +61 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/media/image.d.ts +17 -5
- package/types/api/media/voip.d.ts +103 -0
- package/types/api/open-api/channels.d.ts +31 -0
- package/types/api/open-api/device-voip.d.ts +63 -0
- package/types/api/storage/cache-manager.d.ts +198 -0
- package/types/compile/config/mini.d.ts +14 -1
- package/types/compile/config/project.d.ts +74 -4
- package/types/compile/config/rn.d.ts +6 -2
- package/types/index.d.ts +2 -0
- package/types/taro.api.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.6.9-alpha.
|
|
3
|
+
"version": "3.6.9-alpha.6",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.6.9-alpha.
|
|
25
|
-
"@tarojs/runtime": "3.6.9-alpha.
|
|
24
|
+
"@tarojs/api": "3.6.9-alpha.6",
|
|
25
|
+
"@tarojs/runtime": "3.6.9-alpha.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tarojs/helper": "3.6.9-alpha.
|
|
28
|
+
"@tarojs/helper": "3.6.9-alpha.6"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@types/react": {
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getInferenceEnvInfo {
|
|
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
|
+
/** AI推理引擎版本*/
|
|
15
|
+
ver: string
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
namespace createInferenceSession {
|
|
20
|
+
interface Option {
|
|
21
|
+
/** 模型文件路径,目前只执行后缀为.onnx格式(支持代码包路径,和本地文件系统路径) */
|
|
22
|
+
model: string
|
|
23
|
+
/** 推理精度,有效值为 0 - 4。
|
|
24
|
+
* 一般来说,使用的precesionLevel等级越低,推理速度越快,但可能会损失精度。
|
|
25
|
+
* 推荐开发者在开发时,在效果满足需求时优先使用更低精度以提高推理速度,节约能耗。
|
|
26
|
+
*/
|
|
27
|
+
precesionLevel?: PrecesionLevel
|
|
28
|
+
/** 是否生成量化模型推理 */
|
|
29
|
+
allowQuantize?: boolean
|
|
30
|
+
/** 是否使用NPU推理,仅对IOS有效 */
|
|
31
|
+
allowNPU?: boolean
|
|
32
|
+
/** 输入典型分辨率 */
|
|
33
|
+
typicalShape?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface PrecesionLevel {
|
|
37
|
+
/** 使用fp16 存储浮点,fp16计算,Winograd 算法也采取fp16 计算,开启近似math计算 */
|
|
38
|
+
0
|
|
39
|
+
/** 使用fp16 存储浮点,fp16计算,禁用 Winograd 算法,开启近似math计算 */
|
|
40
|
+
1
|
|
41
|
+
/** 使用fp16 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
|
|
42
|
+
2
|
|
43
|
+
/** 使用fp32 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
|
|
44
|
+
3
|
|
45
|
+
/** 使用fp32 存储浮点,fp32计算,开启 Winograd,关闭近似math计算 */
|
|
46
|
+
4
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface InferenceSession {
|
|
51
|
+
/** 销毁 InferenceSession 实例
|
|
52
|
+
* @supported weapp
|
|
53
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
|
|
54
|
+
*/
|
|
55
|
+
destroy(): void
|
|
56
|
+
/** 取消监听模型加载失败事件. 传入指定回调函数则只取消指定回调,不传则取消所有回调
|
|
57
|
+
* @supported weapp
|
|
58
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offError.html
|
|
59
|
+
*/
|
|
60
|
+
offError(callback?: InferenceSession.OffErrorCallback): void
|
|
61
|
+
/** 取消监听模型加载完成事件
|
|
62
|
+
* @supported weapp
|
|
63
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offLoad.html
|
|
64
|
+
*/
|
|
65
|
+
offLoad(callback?: InferenceSession.OffLoadCallback): void
|
|
66
|
+
/** 监听模型加载失败事件
|
|
67
|
+
* @supported weapp
|
|
68
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onError.html
|
|
69
|
+
*/
|
|
70
|
+
onError(callback: InferenceSession.OnLoadCallback): void
|
|
71
|
+
/** 监听模型加载完成事件
|
|
72
|
+
* @supported weapp
|
|
73
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onLoad.html
|
|
74
|
+
*/
|
|
75
|
+
onLoad(callback: InferenceSession.OnLoadCallback): void
|
|
76
|
+
/** 运行推断
|
|
77
|
+
* 需要在 session.onLoad 回调后使用。接口参数为 Tensors 对象,返回 Promise。
|
|
78
|
+
* 一个 InferenceSession 被创建完成后可以重复多次调用 InferenceSession.run(), 直到调用 session.destroy() 进行销毁。
|
|
79
|
+
* @supported weapp
|
|
80
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
|
|
81
|
+
*/
|
|
82
|
+
run(option: InferenceSession.Tensors): Promise<InferenceSession.Tensors>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
namespace InferenceSession {
|
|
86
|
+
interface Type {
|
|
87
|
+
'uint8'
|
|
88
|
+
'int8'
|
|
89
|
+
'uint32'
|
|
90
|
+
'int32'
|
|
91
|
+
'float32'
|
|
92
|
+
}
|
|
93
|
+
interface Tensor {
|
|
94
|
+
/** Tensor shape (Tensor 形状,例如 [1, 3, 224, 224] 即表示一个4唯Tensor,每个维度的长度分别为1, 3, 224, 224) */
|
|
95
|
+
shape: number[]
|
|
96
|
+
/** Tensor 值,一段 ArrayBuffer */
|
|
97
|
+
data: ArrayBuffer
|
|
98
|
+
/** ArrayBuffer 值的类型,合法值有 uint8, int8, uint32, int32, float32 */
|
|
99
|
+
type: keyof Type
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface Tensors {
|
|
103
|
+
[key: string]: Tensor
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 模型加载失败回调函数。*/
|
|
107
|
+
type OffErrorCallback = (res: TaroGeneral.CallbackResult) => void
|
|
108
|
+
/** 模型加载完成回调函数 */
|
|
109
|
+
type OffLoadCallback = (res: TaroGeneral.CallbackResult) => void
|
|
110
|
+
/** 模型加载失败回调函数 */
|
|
111
|
+
type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
|
|
112
|
+
/** 模型加载完成回调函数 */
|
|
113
|
+
type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface TaroStatic {
|
|
117
|
+
/** 获取通用AI推理引擎版本
|
|
118
|
+
* @supported weapp
|
|
119
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.getInferenceEnvInfo.html
|
|
120
|
+
*/
|
|
121
|
+
getInferenceEnvInfo(
|
|
122
|
+
option: getInferenceEnvInfo.Option
|
|
123
|
+
): void
|
|
124
|
+
|
|
125
|
+
/** 创建 AI 推理 Session
|
|
126
|
+
* @supported weapp
|
|
127
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.createInferenceSession.html
|
|
128
|
+
*/
|
|
129
|
+
createInferenceSession(
|
|
130
|
+
option: createInferenceSession.Option
|
|
131
|
+
): InferenceSession
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -155,6 +155,52 @@ declare module '../../index' {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
namespace preloadWebview {
|
|
159
|
+
interface Option {
|
|
160
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
161
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
162
|
+
/** 接口调用失败的回调函数 */
|
|
163
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
164
|
+
/** 接口调用成功的回调函数 */
|
|
165
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
namespace preloadSkylineView {
|
|
170
|
+
interface Option {
|
|
171
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
172
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
173
|
+
/** 接口调用失败的回调函数 */
|
|
174
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
175
|
+
/** 接口调用成功的回调函数 */
|
|
176
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
namespace preloadAssets {
|
|
181
|
+
interface AssetsObjectType {
|
|
182
|
+
/** 字体 */
|
|
183
|
+
font
|
|
184
|
+
/** 图片 */
|
|
185
|
+
image
|
|
186
|
+
}
|
|
187
|
+
interface AssetsObject {
|
|
188
|
+
/** 类型 */
|
|
189
|
+
type: keyof AssetsObjectType
|
|
190
|
+
/** 资源地址 */
|
|
191
|
+
src: string
|
|
192
|
+
}
|
|
193
|
+
interface Option {
|
|
194
|
+
data: AssetsObjectType[]
|
|
195
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
196
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
197
|
+
/** 接口调用失败的回调函数 */
|
|
198
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
199
|
+
/** 接口调用成功的回调函数 */
|
|
200
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
158
204
|
interface TaroStatic {
|
|
159
205
|
/** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
|
|
160
206
|
* @supported weapp
|
|
@@ -174,6 +220,23 @@ declare module '../../index' {
|
|
|
174
220
|
dimensions?: string | string[],
|
|
175
221
|
): void
|
|
176
222
|
|
|
223
|
+
/** 预加载下个页面的 WebView
|
|
224
|
+
* @supported weapp
|
|
225
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
|
|
226
|
+
*/
|
|
227
|
+
preloadWebview(option: preloadWebview.Option): Promise<TaroGeneral.CallbackResult>
|
|
228
|
+
|
|
229
|
+
/**预加载下个页面所需要的 Skyline 运行环境
|
|
230
|
+
* @supported weapp
|
|
231
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
|
|
232
|
+
*/
|
|
233
|
+
preloadSkylineView(option: preloadSkylineView.Option): Promise<TaroGeneral.CallbackResult>
|
|
234
|
+
|
|
235
|
+
/** 为视图层预加载媒体资源文件, 目前支持:font,image
|
|
236
|
+
* @supported weapp
|
|
237
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
|
|
238
|
+
*/
|
|
239
|
+
preloadAssets(option: preloadAssets.Option): Promise<TaroGeneral.CallbackResult>
|
|
177
240
|
/** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
|
|
178
241
|
*
|
|
179
242
|
* **注意**
|
|
@@ -351,6 +351,50 @@ declare module '../../index' {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
namespace getSkylineInfoSync {
|
|
355
|
+
interface Result {
|
|
356
|
+
/** 当前运行环境是否支持 Skyline 渲染引擎 */
|
|
357
|
+
isSupported: boolean
|
|
358
|
+
/** 当前运行环境 Skyline 渲染引擎 的版本号,形如 0.9.7 */
|
|
359
|
+
version: string
|
|
360
|
+
/** 当前运行环境不支持 Skyline 渲染引擎 的原因,仅在 isSupported 为 false 时出现 */
|
|
361
|
+
reason?: string
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
namespace getSkylineInfo {
|
|
366
|
+
interface Option {
|
|
367
|
+
/** 接口调用成功的回调函数 */
|
|
368
|
+
success?: (res: Result) => void
|
|
369
|
+
/** 接口调用失败的回调函数 */
|
|
370
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
371
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
372
|
+
complete?: (res: TaroGeneral.CallbackResult | Result) => void
|
|
373
|
+
}
|
|
374
|
+
interface Result {
|
|
375
|
+
/** 当前运行环境是否支持 Skyline 渲染引擎 */
|
|
376
|
+
isSupported: boolean
|
|
377
|
+
/** 当前运行环境 Skyline 渲染引擎 的版本号,形如 0.9.7 */
|
|
378
|
+
version: string
|
|
379
|
+
/** 当前运行环境不支持 Skyline 渲染引擎 的原因,仅在 isSupported 为 false 时出现 */
|
|
380
|
+
reason?: string
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
namespace getRendererUserAgent {
|
|
385
|
+
interface Option {
|
|
386
|
+
/** 接口调用成功的回调函数 */
|
|
387
|
+
success?: (res: Result) => void
|
|
388
|
+
/** 接口调用失败的回调函数 */
|
|
389
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
390
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
391
|
+
complete?: (res: TaroGeneral.CallbackResult | Result) => void
|
|
392
|
+
}
|
|
393
|
+
interface Result {
|
|
394
|
+
userAgent: string
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
354
398
|
namespace getDeviceInfo {
|
|
355
399
|
interface Result {
|
|
356
400
|
/** 应用二进制接口类型(仅 Android 支持) */
|
|
@@ -575,6 +619,27 @@ declare module '../../index' {
|
|
|
575
619
|
*/
|
|
576
620
|
getSystemInfo(res?: getSystemInfo.Option): Promise<getSystemInfo.Result>
|
|
577
621
|
|
|
622
|
+
/** 获取当前运行环境对于 Skyline 渲染引擎 的支持情况
|
|
623
|
+
* 基础库 2.26.2 开始支持
|
|
624
|
+
* @supported weapp
|
|
625
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfoSync.html
|
|
626
|
+
*/
|
|
627
|
+
getSkylineInfoSync(): getSkylineInfoSync.Result
|
|
628
|
+
|
|
629
|
+
/** 获取当前运行环境对于 Skyline 渲染引擎 的支持情况
|
|
630
|
+
* 基础库 2.26.2 开始支持
|
|
631
|
+
* @supported weapp
|
|
632
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfo.html
|
|
633
|
+
*/
|
|
634
|
+
getSkylineInfo(option?: getSkylineInfo.Option): Promise<getSkylineInfo.Result>
|
|
635
|
+
|
|
636
|
+
/** 获取 Webview 小程序的 UserAgent
|
|
637
|
+
* 基础库 2.26.3 开始支持
|
|
638
|
+
* @supported weapp
|
|
639
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getRendererUserAgent.html
|
|
640
|
+
*/
|
|
641
|
+
getRendererUserAgent(option?: getRendererUserAgent.Option): Promise<getRendererUserAgent.Result>
|
|
642
|
+
|
|
578
643
|
/** 获取设备基础信息
|
|
579
644
|
* @supported weapp, h5
|
|
580
645
|
* @h5 不支持 abi、benchmarkLevel
|
|
@@ -53,6 +53,41 @@ declare module '../../index' {
|
|
|
53
53
|
) => void
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
namespace onScreenRecordingStateChanged {
|
|
57
|
+
interface ScreenRecordingState {
|
|
58
|
+
/** 开始录屏 */
|
|
59
|
+
start
|
|
60
|
+
/** 结束录屏 */
|
|
61
|
+
stop
|
|
62
|
+
}
|
|
63
|
+
/** 用户录屏事件的监听函数 */
|
|
64
|
+
type Callback = (
|
|
65
|
+
/** 录屏状态 */
|
|
66
|
+
state: keyof ScreenRecordingState,
|
|
67
|
+
) => void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
namespace getScreenRecordingState {
|
|
71
|
+
interface Option {
|
|
72
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
73
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
74
|
+
/** 接口调用失败的回调函数 */
|
|
75
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
76
|
+
/** 接口调用成功的回调函数 */
|
|
77
|
+
success?: (option: SuccessCallbackResult) => void
|
|
78
|
+
}
|
|
79
|
+
interface ScreenRecordingState {
|
|
80
|
+
/** 开始录屏 */
|
|
81
|
+
start
|
|
82
|
+
/** 结束录屏 */
|
|
83
|
+
stop
|
|
84
|
+
}
|
|
85
|
+
interface SuccessCallbackResult {
|
|
86
|
+
/** 录屏状态 */
|
|
87
|
+
state: keyof ScreenRecordingState
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
56
91
|
namespace getScreenBrightness {
|
|
57
92
|
interface Option {
|
|
58
93
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -116,6 +151,15 @@ declare module '../../index' {
|
|
|
116
151
|
callback: onUserCaptureScreen.Callback,
|
|
117
152
|
): void
|
|
118
153
|
|
|
154
|
+
/** 监听用户录屏事件
|
|
155
|
+
* @supported weapp
|
|
156
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html
|
|
157
|
+
*/
|
|
158
|
+
onScreenRecordingStateChanged(
|
|
159
|
+
/** 用户录屏事件的监听函数 */
|
|
160
|
+
callback: onScreenRecordingStateChanged.Callback
|
|
161
|
+
): void
|
|
162
|
+
|
|
119
163
|
/** 用户主动截屏事件。取消事件监听。
|
|
120
164
|
* @supported weapp, tt
|
|
121
165
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
|
|
@@ -125,6 +169,23 @@ declare module '../../index' {
|
|
|
125
169
|
callback: onUserCaptureScreen.Callback,
|
|
126
170
|
): void
|
|
127
171
|
|
|
172
|
+
/** 取消用户录屏事件的监听函数
|
|
173
|
+
* @supported weapp
|
|
174
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html
|
|
175
|
+
*/
|
|
176
|
+
offScreenRecordingStateChanged(
|
|
177
|
+
/** 用户录屏事件的监听函数 */
|
|
178
|
+
callback: onScreenRecordingStateChanged.Callback
|
|
179
|
+
): void
|
|
180
|
+
|
|
181
|
+
/** 查询用户是否在录屏
|
|
182
|
+
* @supported weapp
|
|
183
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html
|
|
184
|
+
*/
|
|
185
|
+
getScreenRecordingState(
|
|
186
|
+
option?: getScreenRecordingState.Option
|
|
187
|
+
): Promise<getScreenRecordingState.SuccessCallbackResult>
|
|
188
|
+
|
|
128
189
|
/**
|
|
129
190
|
* 获取屏幕亮度。
|
|
130
191
|
*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace sendSms {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 预填到发送短信面板的手机号 */
|
|
7
|
+
phoneNumber?: string
|
|
8
|
+
/** 预填到发送短信面板的内容 */
|
|
9
|
+
content?: string
|
|
10
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
11
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用失败的回调函数 */
|
|
13
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 接口调用成功的回调函数 */
|
|
15
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface TaroStatic {
|
|
20
|
+
/** 拉起手机发送短信界面
|
|
21
|
+
* @supported weap
|
|
22
|
+
* @see declare module '../../index'
|
|
23
|
+
*/
|
|
24
|
+
sendSms(option: sendSms.Option): Promise<TaroGeneral.CallbackResul>
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -18,11 +18,23 @@ declare module '../../index' {
|
|
|
18
18
|
interface Option {
|
|
19
19
|
/** 需要预览的图片链接列表。 */
|
|
20
20
|
urls: string[]
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* 微信端为当前显示图片的链接,支付宝端为当前显示图片的索引值
|
|
23
|
+
*/
|
|
24
|
+
current?: string | number
|
|
25
|
+
/**
|
|
26
|
+
* 是否支持长按下载图片
|
|
27
|
+
* @supported alipay 基础库: 1.13.0
|
|
28
|
+
*/
|
|
29
|
+
enablesavephoto?: boolean
|
|
30
|
+
/**
|
|
31
|
+
* 是否在右下角显示下载入口
|
|
32
|
+
* @supported alipay 基础库: 1.13.0
|
|
33
|
+
*/
|
|
34
|
+
enableShowPhotoDownload?: boolean
|
|
35
|
+
/** @supported weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
|
|
24
36
|
showmenu?: boolean
|
|
25
|
-
/** @
|
|
37
|
+
/** @supported weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
|
|
26
38
|
referrerPolicy?: string
|
|
27
39
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
28
40
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -46,7 +58,7 @@ declare module '../../index' {
|
|
|
46
58
|
/** 需要预览的资源列表 */
|
|
47
59
|
sources: Sources[]
|
|
48
60
|
/** 当前显示的资源序号,默认值:0 */
|
|
49
|
-
current?:
|
|
61
|
+
current?: number
|
|
50
62
|
/** 是否显示长按菜单 2.13.0,默认值:true */
|
|
51
63
|
showmenu?: boolean
|
|
52
64
|
/** origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
|
|
@@ -202,6 +202,98 @@ declare module '../../index' {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
namespace join1v1Chat {
|
|
206
|
+
interface Caller {
|
|
207
|
+
/** 昵称 */
|
|
208
|
+
nickname: string
|
|
209
|
+
/** 头像 */
|
|
210
|
+
headImage?: string
|
|
211
|
+
/** 小程序内 openid */
|
|
212
|
+
openid: string
|
|
213
|
+
}
|
|
214
|
+
interface Listener {
|
|
215
|
+
/** 昵称 */
|
|
216
|
+
nickname: string
|
|
217
|
+
/** 头像 */
|
|
218
|
+
headImage?: string
|
|
219
|
+
/** 小程序内 openid */
|
|
220
|
+
openid: string
|
|
221
|
+
}
|
|
222
|
+
interface RoomType {
|
|
223
|
+
/** 语音通话 */
|
|
224
|
+
voice
|
|
225
|
+
/** 视频通话 */
|
|
226
|
+
video
|
|
227
|
+
}
|
|
228
|
+
interface Option {
|
|
229
|
+
/** 呼叫方信息 */
|
|
230
|
+
caller: Caller
|
|
231
|
+
/** 接听方信息 */
|
|
232
|
+
listener: Listener
|
|
233
|
+
/** 窗口背景色
|
|
234
|
+
* @default 0
|
|
235
|
+
*/
|
|
236
|
+
backgroundType?: keyof setEnable1v1Chat.ColorType
|
|
237
|
+
/** 通话类型 */
|
|
238
|
+
roomType?: keyof RoomType
|
|
239
|
+
/** 小窗样式
|
|
240
|
+
* @default 1
|
|
241
|
+
*/
|
|
242
|
+
minWindowType?: keyof setEnable1v1Chat.ColorType
|
|
243
|
+
/** 不允许切换到语音通话
|
|
244
|
+
* @default false
|
|
245
|
+
*/
|
|
246
|
+
disableSwitchVoice?: boolean
|
|
247
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
248
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
249
|
+
/** 接口调用失败的回调函数 */
|
|
250
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
251
|
+
/** 接口调用成功的回调函数 */
|
|
252
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
253
|
+
}
|
|
254
|
+
interface ChatErrCode {
|
|
255
|
+
/** 未开通双人通话 */
|
|
256
|
+
[-20000]
|
|
257
|
+
/** 当前设备不支持 */
|
|
258
|
+
[-20001]
|
|
259
|
+
/** 正在通话中 */
|
|
260
|
+
[-20002]
|
|
261
|
+
/** 其它小程序正在通话中 */
|
|
262
|
+
[-20003]
|
|
263
|
+
/** 内部系统错误 */
|
|
264
|
+
[-30000]
|
|
265
|
+
/** 微信缺失相机权限 */
|
|
266
|
+
[-30001]
|
|
267
|
+
/** 微信缺失录音权限 */
|
|
268
|
+
[-30002]
|
|
269
|
+
/** 小程序缺失录音权限 */
|
|
270
|
+
[-30003]
|
|
271
|
+
/** 小程序缺失相机权限 */
|
|
272
|
+
[-30004]
|
|
273
|
+
/** 当前已在房间内 */
|
|
274
|
+
[-1]
|
|
275
|
+
/** 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 */
|
|
276
|
+
[-2]
|
|
277
|
+
/** 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 */
|
|
278
|
+
[-3]
|
|
279
|
+
/** 系统错误 */
|
|
280
|
+
[-1000]
|
|
281
|
+
}
|
|
282
|
+
interface FailCallbackResult extends TaroGeneral.CallbackResult {
|
|
283
|
+
/** 错误信息 */
|
|
284
|
+
errMsg: string
|
|
285
|
+
/** 错误码 */
|
|
286
|
+
errCode: keyof ChatErrCode
|
|
287
|
+
}
|
|
288
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
289
|
+
/** 错误码 */
|
|
290
|
+
errCode: number
|
|
291
|
+
/** 调用结果 */
|
|
292
|
+
errMsg: string
|
|
293
|
+
}
|
|
294
|
+
type Promised = FailCallbackResult | SuccessCallbackResult
|
|
295
|
+
}
|
|
296
|
+
|
|
205
297
|
namespace exitVoIPChat {
|
|
206
298
|
interface Option {
|
|
207
299
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -264,6 +356,12 @@ declare module '../../index' {
|
|
|
264
356
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html
|
|
265
357
|
*/
|
|
266
358
|
offVoIPChatStateChanged(callback: onVoIPChatStateChanged.Callback): void
|
|
359
|
+
/**
|
|
360
|
+
* 取消监听实时语音通话成员通话状态变化事件
|
|
361
|
+
* @supported weapp
|
|
362
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatSpeakersChanged.html
|
|
363
|
+
*/
|
|
364
|
+
offVoIPChatSpeakersChanged(callback: onVoIPChatSpeakersChanged.Callback): void
|
|
267
365
|
/** 取消监听实时语音通话成员在线状态变化事件
|
|
268
366
|
* @supported weapp
|
|
269
367
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html
|
|
@@ -281,6 +379,11 @@ declare module '../../index' {
|
|
|
281
379
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html
|
|
282
380
|
*/
|
|
283
381
|
joinVoIPChat(option: joinVoIPChat.Option): Promise<joinVoIPChat.Promised>
|
|
382
|
+
/**加入(创建)双人通话
|
|
383
|
+
* @supported weapp
|
|
384
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html
|
|
385
|
+
*/
|
|
386
|
+
join1v1Chat(option: join1v1Chat.Option): Promise<join1v1Chat.Promised>
|
|
284
387
|
/** 退出(销毁)实时语音通话
|
|
285
388
|
* @supported weapp
|
|
286
389
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html
|
|
@@ -68,6 +68,31 @@ declare module '../../index' {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
namespace getChannelsShareKey {
|
|
72
|
+
interface Option {
|
|
73
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
74
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
75
|
+
/** 接口调用失败的回调函数 */
|
|
76
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
77
|
+
/** 接口调用成功的回调函数 */
|
|
78
|
+
success?: (result: SuccessCallbackResult) => void
|
|
79
|
+
}
|
|
80
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
81
|
+
/** 分享者 openid */
|
|
82
|
+
sharerOpenId: string
|
|
83
|
+
/** 推广员 */
|
|
84
|
+
promoter: Promoter
|
|
85
|
+
}
|
|
86
|
+
interface Promoter {
|
|
87
|
+
/** 推广员昵称 */
|
|
88
|
+
finderNickname: string
|
|
89
|
+
/** 推广员id */
|
|
90
|
+
promoterId: string
|
|
91
|
+
/** 推广员openid */
|
|
92
|
+
promoterOpenId: string
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
71
96
|
namespace getChannelsLiveNoticeInfo {
|
|
72
97
|
interface Option {
|
|
73
98
|
/** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
|
|
@@ -164,6 +189,12 @@ declare module '../../index' {
|
|
|
164
189
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html
|
|
165
190
|
*/
|
|
166
191
|
openChannelsActivity(option?: openChannelsActivity.Option): Promise<TaroGeneral.CallbackResult>
|
|
192
|
+
/** 获取视频号直播卡片/视频卡片的分享来源,
|
|
193
|
+
* 仅当卡片携带了分享信息、同时用户已授权该小程序获取视频号分享信息且启动场景值为 1177、1184、1195、1208 时可用
|
|
194
|
+
* @supported weapp
|
|
195
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsShareKey.html
|
|
196
|
+
*/
|
|
197
|
+
getChannelsShareKey(option?: getChannelsShareKey.Option): Promise<getChannelsShareKey.SuccessCallbackResult>
|
|
167
198
|
/** 获取视频号直播预告信息
|
|
168
199
|
* @supported weapp
|
|
169
200
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace requestDeviceVoIP {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-) */
|
|
7
|
+
sn: string
|
|
8
|
+
/** 设备票据,5分钟内有效 */
|
|
9
|
+
snTicket: string
|
|
10
|
+
/** 设备型号 id。通过微信公众平台注册设备获得。 */
|
|
11
|
+
modelId: string
|
|
12
|
+
/** 设备名称,将显示在授权弹窗内(长度不超过13)。授权框中「设备名字」= 「deviceName」 + 「modelId 对应设备型号」 */
|
|
13
|
+
deviceName: string
|
|
14
|
+
/** 是否为授权设备组,默认 false */
|
|
15
|
+
isGroup?: boolean
|
|
16
|
+
/** 设备组的唯一标识 id 。isGroup 为 true 时只需要传该参数,isGroup 为 false 时不需要传该参数,但需要传 sn、snTicket、modelId、deviceName 。 */
|
|
17
|
+
groupId: string
|
|
18
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
19
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
/** 接口调用失败的回调函数 */
|
|
21
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
22
|
+
/** 接口调用成功的回调函数 */
|
|
23
|
+
success?: (result: SuccessCallbackResult) => void
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
namespace getDeviceVoIPList {
|
|
28
|
+
interface Option {
|
|
29
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
30
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
31
|
+
/** 接口调用失败的回调函数 */
|
|
32
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
33
|
+
/** 接口调用成功的回调函数 */
|
|
34
|
+
success?: (result: SuccessCallbackResult) => void
|
|
35
|
+
}
|
|
36
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
37
|
+
list: DeviceVoIP[]
|
|
38
|
+
}
|
|
39
|
+
interface DeviceVoIP {
|
|
40
|
+
/** 设备唯一序列号。(仅单台设备时) */
|
|
41
|
+
sn: string
|
|
42
|
+
/** 设备型号 id。通过微信公众平台注册设备获得。(仅单台设备时) */
|
|
43
|
+
model_id: string
|
|
44
|
+
/** 设备组的唯一标识 id(仅设备组时) */
|
|
45
|
+
group_id: string
|
|
46
|
+
/** 设备(组)授权状态。0:未授权;1:已授权 */
|
|
47
|
+
status: number
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface TaroStatic {
|
|
52
|
+
/** 请求用户授权与设备(组)间进行音视频通话
|
|
53
|
+
* @supported weapp
|
|
54
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.requestDeviceVoIP.html
|
|
55
|
+
*/
|
|
56
|
+
requestDeviceVoIP(option: requestDeviceVoIP.Option): Promise<TaroGeneral.CallbackResult>
|
|
57
|
+
/** 查询当前用户授权的音视频通话设备(组)信息
|
|
58
|
+
* @supported weapp
|
|
59
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html
|
|
60
|
+
*/
|
|
61
|
+
getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
interface CacheManager {
|
|
5
|
+
/** 添加规则
|
|
6
|
+
* @supported weapp
|
|
7
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html
|
|
8
|
+
*/
|
|
9
|
+
addRule(option: CacheManager.AddRuleOption): string
|
|
10
|
+
/** 批量添加规则
|
|
11
|
+
* @supported weapp
|
|
12
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRules.html
|
|
13
|
+
*/
|
|
14
|
+
addRules(option: CacheManager.AddRulesOption): string[]
|
|
15
|
+
/** 清空所有缓存
|
|
16
|
+
* @supported weapp
|
|
17
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearCaches.html
|
|
18
|
+
*/
|
|
19
|
+
clearCaches(): void
|
|
20
|
+
/** 清空所有规则,同时会删除对应规则下所有缓存
|
|
21
|
+
* @supported weapp
|
|
22
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearRules.html
|
|
23
|
+
*/
|
|
24
|
+
clearRules(): void
|
|
25
|
+
/** 删除缓存
|
|
26
|
+
* @supported weapp
|
|
27
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html
|
|
28
|
+
*/
|
|
29
|
+
deleteCache(
|
|
30
|
+
/** 缓存 id */
|
|
31
|
+
id: string
|
|
32
|
+
): void
|
|
33
|
+
/** 批量删除缓存
|
|
34
|
+
* @supported weapp
|
|
35
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCaches.html
|
|
36
|
+
*/
|
|
37
|
+
deleteCaches(
|
|
38
|
+
/** 缓存 id 列表 */
|
|
39
|
+
ids: string[]
|
|
40
|
+
): void
|
|
41
|
+
/** 删除规则,同时会删除对应规则下所有缓存
|
|
42
|
+
* @supported weapp
|
|
43
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
|
|
44
|
+
*/
|
|
45
|
+
deleteRule(
|
|
46
|
+
/** 规则 id */
|
|
47
|
+
id: string
|
|
48
|
+
): void
|
|
49
|
+
/** 批量删除规则,同时会删除对应规则下所有缓存
|
|
50
|
+
* @supported weapp
|
|
51
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRules.html
|
|
52
|
+
*/
|
|
53
|
+
deleteRules(
|
|
54
|
+
/** 规则 id 列表 */
|
|
55
|
+
ids: string[]
|
|
56
|
+
): void
|
|
57
|
+
/** 匹配命中的缓存规则,一般需要和 request 事件搭配使用
|
|
58
|
+
* @supported weapp
|
|
59
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.match.html
|
|
60
|
+
*/
|
|
61
|
+
match(option: CacheManager.MatchOption): CacheManager.MatchResult
|
|
62
|
+
/** 取消事件监听
|
|
63
|
+
* @supported weapp
|
|
64
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.off.html
|
|
65
|
+
*/
|
|
66
|
+
off(
|
|
67
|
+
/** 事件名称 */
|
|
68
|
+
eventName: string,
|
|
69
|
+
/** 事件监听函数 */
|
|
70
|
+
handler: Function
|
|
71
|
+
): void
|
|
72
|
+
/** 监听事件
|
|
73
|
+
* @supported weapp
|
|
74
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html
|
|
75
|
+
*/
|
|
76
|
+
on(
|
|
77
|
+
/** 事件名称 */
|
|
78
|
+
eventName: keyof CacheManager.OnEventName,
|
|
79
|
+
/** 事件监听函数 */
|
|
80
|
+
handler: Function
|
|
81
|
+
): void
|
|
82
|
+
/** 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1
|
|
83
|
+
* @supported weapp
|
|
84
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.start.html
|
|
85
|
+
*/
|
|
86
|
+
start(): void
|
|
87
|
+
/** 关闭缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 0
|
|
88
|
+
* @supported weapp
|
|
89
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.stop.html
|
|
90
|
+
*/
|
|
91
|
+
stop(): void
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
namespace CacheManager {
|
|
95
|
+
interface DataSchema {
|
|
96
|
+
/** 需要匹配的 data 对象的参数类型
|
|
97
|
+
* string、number、boolean、null、object、any(表示任意类型),
|
|
98
|
+
* 同时支持数组模式(数组模式则在类型后面加 [],如 string[] 表示字符串数组)
|
|
99
|
+
*/
|
|
100
|
+
type: string
|
|
101
|
+
/** 需要匹配的 data 对象的参数值
|
|
102
|
+
* 当 type 为基本类型时,可以用 string/regexp 来匹配固定的值,
|
|
103
|
+
* 也可以通过 function 来确定值是否匹配,
|
|
104
|
+
* 如果传入的 type 是 object,那么表示需要嵌套匹配值是否正确,可以传入 Array
|
|
105
|
+
*/
|
|
106
|
+
value?: string | RegExp | Function | DataRule[]
|
|
107
|
+
}
|
|
108
|
+
interface DataRule {
|
|
109
|
+
/** 需要匹配的参数名 */
|
|
110
|
+
name: string
|
|
111
|
+
schema: DataSchema | DataSchema[]
|
|
112
|
+
}
|
|
113
|
+
interface RuleObject {
|
|
114
|
+
/** 规则 id,如果不填则会由基础库生成 */
|
|
115
|
+
id: string
|
|
116
|
+
/** 请求方法,可选值 GET/POST/PATCH/PUT/DELETE,如果为空则表示前面提到的所有方法都能被匹配到 */
|
|
117
|
+
method: string
|
|
118
|
+
/** uri 匹配规则,可参考规则字符串写法和正则写法 */
|
|
119
|
+
url: any
|
|
120
|
+
/**
|
|
121
|
+
* 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间
|
|
122
|
+
* @default 7 * 24 * 60 * 60 * 1000
|
|
123
|
+
*/
|
|
124
|
+
maxAge: number
|
|
125
|
+
/**
|
|
126
|
+
* 匹配请求参数
|
|
127
|
+
*/
|
|
128
|
+
dataSchema: DataRule[]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type Rule = string | RegExp | RuleObject
|
|
132
|
+
|
|
133
|
+
interface AddRuleOption {
|
|
134
|
+
/** 规则 */
|
|
135
|
+
rule: Rule
|
|
136
|
+
}
|
|
137
|
+
interface AddRulesOption {
|
|
138
|
+
rules: Rule[]
|
|
139
|
+
}
|
|
140
|
+
interface MatchOption {
|
|
141
|
+
/** request 事件对象 */
|
|
142
|
+
evt: any
|
|
143
|
+
}
|
|
144
|
+
interface MatchResult {
|
|
145
|
+
/** 命中的规则id */
|
|
146
|
+
ruleId: string
|
|
147
|
+
/** 缓存id */
|
|
148
|
+
cacheId: string
|
|
149
|
+
/** 缓存内容,会带有 fromCache 标记,方便开发者区分内容是否来自缓存 */
|
|
150
|
+
data: any
|
|
151
|
+
/** 缓存创建时间 */
|
|
152
|
+
createTime: number
|
|
153
|
+
/** 缓存有效时间 */
|
|
154
|
+
maxAge: number
|
|
155
|
+
}
|
|
156
|
+
interface OnEventName {
|
|
157
|
+
/** 发生 wx.request 请求,只在缓存管理器开启阶段会触发 */
|
|
158
|
+
request
|
|
159
|
+
/** 进入弱网/离线状态 */
|
|
160
|
+
enterWeakNetwork
|
|
161
|
+
/** 离开弱网/离线状态 */
|
|
162
|
+
exitWeakNetwork
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
namespace createCacheManager {
|
|
167
|
+
interface Mode {
|
|
168
|
+
/** 弱网/离线使用缓存返回 */
|
|
169
|
+
weakNetwork
|
|
170
|
+
/** 总是使用缓存返回 */
|
|
171
|
+
always
|
|
172
|
+
/** 不开启,后续可手动开启/停止使用缓存返回 */
|
|
173
|
+
none
|
|
174
|
+
}
|
|
175
|
+
interface Extra {
|
|
176
|
+
/** 需要缓存的 wx api 接口,不传则表示支持缓存的接口全都做缓存处理。返回的如果是缓存数据,开发者可通过 fromCache 标记区分 */
|
|
177
|
+
apiList?: string[]
|
|
178
|
+
}
|
|
179
|
+
interface Option {
|
|
180
|
+
/** 全局 origin */
|
|
181
|
+
origin?: string
|
|
182
|
+
/** 缓存模式 */
|
|
183
|
+
mode?: keyof Mode
|
|
184
|
+
/** 全局缓存有效时间,单位为毫秒,默认为 7 天,最长不超过 30 天 */
|
|
185
|
+
maxAge?: number
|
|
186
|
+
/** 额外的缓存处理 */
|
|
187
|
+
extra?: Extra
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface TaroStatic {
|
|
192
|
+
/** 拉起手机发送短信界面
|
|
193
|
+
* @supported weap
|
|
194
|
+
* @see declare module '../../index'
|
|
195
|
+
*/
|
|
196
|
+
createCacheManager(option: createCacheManager.Option): CacheManager
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -35,7 +35,20 @@ export interface IMiniAppConfig {
|
|
|
35
35
|
webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void
|
|
36
36
|
|
|
37
37
|
/** 可用于修改、拓展 Webpack 的 [output](https://webpack.js.org/configuration/output/) 选项 */
|
|
38
|
-
output?: Webpack.Configuration['output']
|
|
38
|
+
output?: Webpack.Configuration['output'] & {
|
|
39
|
+
/**
|
|
40
|
+
* 编译前清空输出目录
|
|
41
|
+
* @since Taro v3.6.9
|
|
42
|
+
* @description
|
|
43
|
+
* - 默认清空输出目录,可设置 clean: false 不清空
|
|
44
|
+
* - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
|
|
45
|
+
* - 注意 clean.keep 不支持函数
|
|
46
|
+
*/
|
|
47
|
+
clean?: boolean | {
|
|
48
|
+
/** 保留指定文件不删除 */
|
|
49
|
+
keep?: Array<string | RegExp> | string | RegExp
|
|
50
|
+
}
|
|
51
|
+
}
|
|
39
52
|
|
|
40
53
|
/** 配置 postcss 相关插件 */
|
|
41
54
|
postcss?: IPostcssOption
|
|
@@ -63,13 +63,48 @@ export interface IProjectBaseConfig {
|
|
|
63
63
|
/** 代码编译后的生产目录 (默认值:'dist') */
|
|
64
64
|
outputRoot?: string
|
|
65
65
|
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* 用于配置`process.env.xxxx`相关的环境变量
|
|
68
|
+
* @deprecated 建议使用根目录下的 .env 文件替代
|
|
69
|
+
* @description 注意:这里的环境变量只能在业务代码中使用,编译时的 node 环境中无法使用
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* // config/index.ts
|
|
73
|
+
* export default defineConfig({
|
|
74
|
+
* env: {
|
|
75
|
+
* xxxx: '"测试"'
|
|
76
|
+
* }
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* // src/app.ts
|
|
80
|
+
* onShow() {
|
|
81
|
+
* console.log(process.env.xxxx) // 打印 "测试"
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
67
85
|
env?: IOption
|
|
68
86
|
|
|
69
87
|
/** 用于配置目录别名,从而方便书写代码引用路径 */
|
|
70
88
|
alias?: IOption
|
|
71
89
|
|
|
72
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* 用于配置一些常量供代码中进行全局替换使用
|
|
92
|
+
* @description 注意:这里的环境变量只能在业务代码中使用,编译时的 node 环境中无法使用
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* // config/index.ts
|
|
96
|
+
* export default defineConfig({
|
|
97
|
+
* defineConstants: {
|
|
98
|
+
* __TEST__: JSON.stringify('test')
|
|
99
|
+
* }
|
|
100
|
+
* })
|
|
101
|
+
*
|
|
102
|
+
* // src/app.ts
|
|
103
|
+
* onShow() {
|
|
104
|
+
* console.log(__TEST__) // 打印 "test"
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
73
108
|
defineConstants?: IOption
|
|
74
109
|
|
|
75
110
|
/** 用于把文件从源码目录直接拷贝到编译后的生产目录 */
|
|
@@ -177,13 +212,48 @@ export interface IProjectConfig {
|
|
|
177
212
|
/** 代码编译后的生产目录 (默认值:'dist') */
|
|
178
213
|
outputRoot?: string
|
|
179
214
|
|
|
180
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* 用于配置`process.env.xxxx`相关的环境变量
|
|
217
|
+
* @deprecated 建议使用根目录下的 .env 文件替代
|
|
218
|
+
* @description 注意:这里的环境变量只能在业务代码中使用,编译时的 node 环境中无法使用
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* // config/index.ts
|
|
222
|
+
* export default defineConfig({
|
|
223
|
+
* env: {
|
|
224
|
+
* xxxx: '"测试"'
|
|
225
|
+
* }
|
|
226
|
+
* })
|
|
227
|
+
*
|
|
228
|
+
* // src/app.ts
|
|
229
|
+
* onShow() {
|
|
230
|
+
* console.log(process.env.xxxx) // 打印 "测试"
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
181
234
|
env?: IOption
|
|
182
235
|
|
|
183
236
|
/** 用于配置目录别名,从而方便书写代码引用路径 */
|
|
184
237
|
alias?: IOption
|
|
185
238
|
|
|
186
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* 用于配置一些常量供代码中进行全局替换使用
|
|
241
|
+
* @description 注意:这里的环境变量只能在业务代码中使用,编译时的 node 环境中无法使用
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* // config/index.ts
|
|
245
|
+
* export default defineConfig({
|
|
246
|
+
* defineConstants: {
|
|
247
|
+
* __TEST__: JSON.stringify('test')
|
|
248
|
+
* }
|
|
249
|
+
* })
|
|
250
|
+
*
|
|
251
|
+
* // src/app.ts
|
|
252
|
+
* onShow() {
|
|
253
|
+
* console.log(__TEST__) // 打印 "test"
|
|
254
|
+
* }
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
187
257
|
defineConstants?: IOption
|
|
188
258
|
|
|
189
259
|
/** 用于把文件从源码目录直接拷贝到编译后的生产目录 */
|
|
@@ -32,11 +32,15 @@ export interface IRNConfig {
|
|
|
32
32
|
pxtransform?: {
|
|
33
33
|
enable?: boolean
|
|
34
34
|
/** 插件 pxtransform 配置项 */
|
|
35
|
-
config
|
|
35
|
+
config?: {
|
|
36
36
|
additionalProperties?: boolean
|
|
37
37
|
[key: string]: any
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
cssModules?: {
|
|
41
|
+
enable: boolean
|
|
42
|
+
},
|
|
43
|
+
[key: string]: any
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
resolve?: any
|
package/types/index.d.ts
CHANGED
|
@@ -130,6 +130,8 @@
|
|
|
130
130
|
/// <reference types="@tarojs/plugin-platform-swan/types/shims-swan" />
|
|
131
131
|
/// <reference types="@tarojs/plugin-platform-tt/types/shims-tt" />
|
|
132
132
|
/// <reference types="@tarojs/plugin-platform-weapp/types/shims-weapp" />
|
|
133
|
+
/// <reference types="@tarojs/taro-h5/types/overlay" />
|
|
134
|
+
/// <reference types="@tarojs/taro-rn/types/overlay" />
|
|
133
135
|
|
|
134
136
|
export = Taro
|
|
135
137
|
export as namespace Taro
|
package/types/taro.api.d.ts
CHANGED
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
/// <reference path="api/payment/index.d.ts" />
|
|
42
42
|
/// <reference path="api/storage/index.d.ts" />
|
|
43
43
|
/// <reference path="api/storage/background-fetch.d.ts" />
|
|
44
|
+
/// <reference path="api/storage/cache-manager.d.ts" />
|
|
44
45
|
/// <reference path="api/data-analysis/index.d.ts" />
|
|
45
46
|
/// <reference path="api/canvas/index.d.ts" />
|
|
46
47
|
/// <reference path="api/media/map.d.ts" />
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
/// <reference path="api/open-api/favorites.d.ts" />
|
|
74
75
|
/// <reference path="api/open-api/license-plate.d.ts" />
|
|
75
76
|
/// <reference path="api/open-api/channels.d.ts" />
|
|
77
|
+
/// <reference path="api/open-api/device-voip.d.ts" />
|
|
76
78
|
/// <reference path="api/open-api/group.d.ts" />
|
|
77
79
|
/// <reference path="api/open-api/customer-service.d.ts" />
|
|
78
80
|
/// <reference path="api/device/bluetooth.d.ts" />
|
|
@@ -88,6 +90,7 @@
|
|
|
88
90
|
/// <reference path="api/device/clipboard.d.ts" />
|
|
89
91
|
/// <reference path="api/device/network.d.ts" />
|
|
90
92
|
/// <reference path="api/device/screen.d.ts" />
|
|
93
|
+
/// <reference path="api/device/sms.d.ts" />
|
|
91
94
|
/// <reference path="api/device/keyboard.d.ts" />
|
|
92
95
|
/// <reference path="api/device/phone.d.ts" />
|
|
93
96
|
/// <reference path="api/device/accelerometer.d.ts" />
|
|
@@ -99,6 +102,7 @@
|
|
|
99
102
|
/// <reference path="api/device/vibrate.d.ts" />
|
|
100
103
|
/// <reference path="api/ai/visionkit.d.ts" />
|
|
101
104
|
/// <reference path="api/ai/face.d.ts" />
|
|
105
|
+
/// <reference path="api/ai/inference.d.ts" />
|
|
102
106
|
/// <reference path="api/worker/index.d.ts" />
|
|
103
107
|
/// <reference path="api/wxml/index.d.ts" />
|
|
104
108
|
/// <reference path="api/ext/index.d.ts" />
|