@tarojs/taro 3.7.0-alpha.2 → 3.7.0-alpha.4
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 +9 -3
- package/types/api/ai/inference.d.ts +133 -0
- package/types/api/base/crypto.d.ts +17 -3
- package/types/api/base/index.d.ts +2 -2
- package/types/api/base/performance.d.ts +63 -0
- package/types/api/base/system.d.ts +65 -0
- package/types/api/base/weapp/app-event.d.ts +18 -18
- package/types/api/device/calendar.d.ts +2 -2
- 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 +40 -17
- package/types/api/media/live.d.ts +52 -0
- package/types/api/media/video.d.ts +64 -23
- package/types/api/media/voip.d.ts +103 -0
- package/types/api/network/request.d.ts +18 -15
- 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/api/taro.extend.d.ts +200 -0
- package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
- package/types/compile/compiler.d.ts +1 -1
- package/types/compile/config/h5.d.ts +63 -2
- package/types/compile/config/mini.d.ts +43 -4
- package/types/compile/config/project.d.ts +226 -10
- package/types/compile/config/rn.d.ts +56 -0
- package/types/compile/config/util.d.ts +62 -4
- package/types/global.d.ts +8 -8
- package/types/index.d.ts +7 -7
- package/types/taro.api.d.ts +8 -1
- package/types/taro.component.d.ts +2 -1
- package/types/taro.config.d.ts +8 -1
- package/types/taro.extend.d.ts +0 -112
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.4",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.7.0-alpha.
|
|
25
|
-
"@tarojs/runtime": "3.7.0-alpha.
|
|
24
|
+
"@tarojs/api": "3.7.0-alpha.4",
|
|
25
|
+
"@tarojs/runtime": "3.7.0-alpha.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@tarojs/helper": "3.7.0-alpha.4"
|
|
26
29
|
},
|
|
27
30
|
"peerDependenciesMeta": {
|
|
28
31
|
"@types/react": {
|
|
@@ -34,6 +37,9 @@
|
|
|
34
37
|
"@types/webpack-dev-server": {
|
|
35
38
|
"optional": true
|
|
36
39
|
},
|
|
40
|
+
"postcss": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
37
43
|
"vue": {
|
|
38
44
|
"optional": true
|
|
39
45
|
}
|
|
@@ -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
|
+
}
|
|
@@ -26,7 +26,7 @@ declare module '../../index' {
|
|
|
26
26
|
* @supported weapp
|
|
27
27
|
* @example
|
|
28
28
|
* ```tsx
|
|
29
|
-
* Taro.getRandomValues({
|
|
29
|
+
* Taro.getUserCryptoManager().getRandomValues({
|
|
30
30
|
* length: 6 // 生成 6 个字节长度的随机数,
|
|
31
31
|
* success: res => {
|
|
32
32
|
* console.log(Taro.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
|
|
@@ -35,7 +35,7 @@ declare module '../../index' {
|
|
|
35
35
|
* ```
|
|
36
36
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html
|
|
37
37
|
*/
|
|
38
|
-
getRandomValues(option: UserCryptoManager.getRandomValues.Option):
|
|
38
|
+
getRandomValues(option: UserCryptoManager.getRandomValues.Option): void
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
namespace UserCryptoManager {
|
|
@@ -66,7 +66,7 @@ declare module '../../index' {
|
|
|
66
66
|
/** 整数,生成随机数的字节数,最大 1048576 */
|
|
67
67
|
length: number
|
|
68
68
|
/** 接口调用成功的回调函数 */
|
|
69
|
-
success?: (res:
|
|
69
|
+
success?: (res: SuccessCallbackResult) => void
|
|
70
70
|
/** 接口调用失败的回调函数 */
|
|
71
71
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
72
72
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -86,5 +86,19 @@ declare module '../../index' {
|
|
|
86
86
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html
|
|
87
87
|
*/
|
|
88
88
|
getUserCryptoManager(): UserCryptoManager
|
|
89
|
+
|
|
90
|
+
/** 获取密码学安全随机数
|
|
91
|
+
* @supported weapp
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* Taro.getRandomValues({
|
|
95
|
+
* length: 6 // 生成 6 个字节长度的随机数
|
|
96
|
+
* }).then(res => {
|
|
97
|
+
* console.log(Taro.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
|
|
98
|
+
* })
|
|
99
|
+
* ```
|
|
100
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html
|
|
101
|
+
*/
|
|
102
|
+
getRandomValues(option: UserCryptoManager.getRandomValues.Option): Promise<UserCryptoManager.getRandomValues.SuccessCallbackResult>
|
|
89
103
|
}
|
|
90
104
|
}
|
|
@@ -3,7 +3,7 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
interface TaroStatic {
|
|
5
5
|
/** 判断小程序的 API,回调,参数,组件等是否在当前版本可用。
|
|
6
|
-
* @supported weapp, tt
|
|
6
|
+
* @supported weapp, tt, h5
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
9
|
* Taro.canIUse('openBluetoothAdapter')
|
|
@@ -36,7 +36,7 @@ declare module '../../index' {
|
|
|
36
36
|
): boolean
|
|
37
37
|
|
|
38
38
|
/** 判断能否使用 WebP 格式
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* > 在小程序平台中仅在 android 和 devtools 设备时可用
|
|
41
41
|
* @supported global
|
|
42
42
|
*/
|
|
@@ -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
|
|
@@ -18,7 +18,7 @@ declare module '../../../index' {
|
|
|
18
18
|
/** 小程序错误事件的回调函数 */
|
|
19
19
|
type Callback = (
|
|
20
20
|
/** 错误信息,包含堆栈 */
|
|
21
|
-
error: string,
|
|
21
|
+
error: string | ErrorEvent | Error,
|
|
22
22
|
) => void
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -113,13 +113,13 @@ declare module '../../../index' {
|
|
|
113
113
|
*
|
|
114
114
|
* **注意**
|
|
115
115
|
* - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
|
|
116
|
-
* @supported weapp, tt
|
|
116
|
+
* @supported weapp, tt, h5
|
|
117
117
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html
|
|
118
118
|
*/
|
|
119
119
|
onUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
|
|
120
120
|
|
|
121
121
|
/** 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
|
|
122
|
-
* @supported weapp
|
|
122
|
+
* @supported weapp, h5
|
|
123
123
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html
|
|
124
124
|
*/
|
|
125
125
|
onThemeChange(callback: onThemeChange.Callback): void
|
|
@@ -131,13 +131,13 @@ declare module '../../../index' {
|
|
|
131
131
|
* - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
|
|
132
132
|
* - 若开发者没有调用 [Taro.onPageNotFound](/docs/apis/base/weapp/app-event/onPageNotFound) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
|
|
133
133
|
* - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。
|
|
134
|
-
* @supported weapp,
|
|
134
|
+
* @supported weapp, tt, h5
|
|
135
135
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html
|
|
136
136
|
*/
|
|
137
137
|
onPageNotFound(callback: onPageNotFound.Callback): void
|
|
138
138
|
|
|
139
139
|
/** 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
|
|
140
|
-
* @supported weapp, tt
|
|
140
|
+
* @supported weapp, tt, h5
|
|
141
141
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
|
|
142
142
|
*/
|
|
143
143
|
onError(callback: onError.Callback): void
|
|
@@ -178,16 +178,16 @@ declare module '../../../index' {
|
|
|
178
178
|
* **注意**
|
|
179
179
|
*
|
|
180
180
|
* 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
|
|
181
|
-
* @supported weapp,
|
|
181
|
+
* @supported weapp, tt, h5
|
|
182
182
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html
|
|
183
183
|
*/
|
|
184
184
|
onAppShow(
|
|
185
185
|
/** 小程序切前台事件的回调函数 */
|
|
186
|
-
callback: (
|
|
186
|
+
callback: (res: onAppShow.CallbackResult) => void,
|
|
187
187
|
): void
|
|
188
188
|
|
|
189
189
|
/** 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
|
|
190
|
-
* @supported weapp,
|
|
190
|
+
* @supported weapp, tt, h5
|
|
191
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html
|
|
192
192
|
*/
|
|
193
193
|
onAppHide(
|
|
@@ -196,34 +196,34 @@ declare module '../../../index' {
|
|
|
196
196
|
): void
|
|
197
197
|
|
|
198
198
|
/** 取消监听未处理的 Promise 拒绝事件
|
|
199
|
-
* @supported weapp, tt
|
|
199
|
+
* @supported weapp, tt, h5
|
|
200
200
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html
|
|
201
201
|
*/
|
|
202
202
|
offUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
|
|
203
203
|
|
|
204
204
|
/** 取消监听系统主题改变事件
|
|
205
|
-
* @supported weapp
|
|
205
|
+
* @supported weapp, h5
|
|
206
206
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html
|
|
207
207
|
*/
|
|
208
208
|
offThemeChange(callback: onThemeChange.Callback): void
|
|
209
209
|
|
|
210
210
|
/** 取消监听小程序要打开的页面不存在事件
|
|
211
|
-
* @supported weapp, tt
|
|
211
|
+
* @supported weapp, tt, h5
|
|
212
212
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html
|
|
213
213
|
*/
|
|
214
214
|
offPageNotFound(
|
|
215
215
|
/** 小程序要打开的页面不存在事件的回调函数 */
|
|
216
|
-
callback:
|
|
216
|
+
callback: onPageNotFound.Callback,
|
|
217
217
|
): void
|
|
218
218
|
|
|
219
219
|
/** 取消监听音频播放错误事件
|
|
220
|
-
* @supported weapp, tt
|
|
220
|
+
* @supported weapp, tt, h5
|
|
221
221
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html
|
|
222
222
|
*/
|
|
223
223
|
|
|
224
224
|
offError(
|
|
225
225
|
/** 音频播放错误事件的回调函数 */
|
|
226
|
-
callback:
|
|
226
|
+
callback: onError.Callback,
|
|
227
227
|
): void
|
|
228
228
|
|
|
229
229
|
/** 取消监听音频中断结束事件
|
|
@@ -245,21 +245,21 @@ declare module '../../../index' {
|
|
|
245
245
|
): void
|
|
246
246
|
|
|
247
247
|
/** 取消监听小程序切前台事件
|
|
248
|
-
* @supported weapp,
|
|
248
|
+
* @supported weapp, tt, h5
|
|
249
249
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html
|
|
250
250
|
*/
|
|
251
251
|
offAppShow(
|
|
252
252
|
/** 小程序切前台事件的回调函数 */
|
|
253
|
-
callback: (res:
|
|
253
|
+
callback: (res: onAppShow.CallbackResult) => void,
|
|
254
254
|
): void
|
|
255
255
|
|
|
256
256
|
/** 取消监听小程序切后台事件
|
|
257
|
-
* @supported weapp,
|
|
257
|
+
* @supported weapp, tt, h5
|
|
258
258
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html
|
|
259
259
|
*/
|
|
260
260
|
offAppHide(
|
|
261
261
|
/** 小程序切后台事件的回调函数 */
|
|
262
|
-
callback: (res:
|
|
262
|
+
callback: (res: onAppShow.CallbackResult) => void,
|
|
263
263
|
): void
|
|
264
264
|
}
|
|
265
265
|
}
|
|
@@ -75,12 +75,12 @@ declare module '../../index' {
|
|
|
75
75
|
|
|
76
76
|
interface TaroStatic {
|
|
77
77
|
/** 向系统日历添加重复事件
|
|
78
|
-
* @supported weapp
|
|
78
|
+
* @supported weapp, h5
|
|
79
79
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
|
|
80
80
|
*/
|
|
81
81
|
addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
82
82
|
/** 向系统日历添加事件
|
|
83
|
-
* @supported weapp, tt
|
|
83
|
+
* @supported weapp, tt, h5
|
|
84
84
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
|
|
85
85
|
*/
|
|
86
86
|
addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -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
|
+
}
|