@tarojs/taro 3.7.0-alpha.2 → 3.7.0-alpha.20
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 +16 -3
- package/types/api/ad/index.d.ts +6 -18
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +625 -54
- package/types/api/alipay/index.d.ts +43 -0
- package/types/api/base/crypto.d.ts +18 -4
- package/types/api/base/index.d.ts +2 -2
- package/types/api/base/performance.d.ts +65 -2
- package/types/api/base/system.d.ts +65 -0
- package/types/api/base/weapp/app-event.d.ts +18 -18
- package/types/api/canvas/index.d.ts +67 -54
- 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/audio.d.ts +50 -30
- 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/download.d.ts +2 -10
- package/types/api/network/request.d.ts +84 -24
- package/types/api/network/upload.d.ts +2 -10
- package/types/api/open-api/address.d.ts +12 -10
- package/types/api/open-api/channels.d.ts +31 -0
- package/types/api/open-api/device-voip.d.ts +63 -0
- 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 +99 -0
- package/types/api/route/index.d.ts +3 -0
- package/types/api/share/index.d.ts +1 -1
- package/types/api/skyline/index.d.ts +59 -0
- package/types/api/storage/cache-manager.d.ts +198 -0
- package/types/api/taro.extend.d.ts +223 -0
- package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
- package/types/api/ui/navigation-bar.d.ts +1 -1
- package/types/compile/compiler.d.ts +8 -6
- package/types/compile/config/h5.d.ts +76 -9
- package/types/compile/config/mini.d.ts +80 -10
- package/types/compile/config/project.d.ts +242 -20
- package/types/compile/config/rn.d.ts +64 -0
- package/types/compile/config/util.d.ts +83 -11
- package/types/compile/hooks.d.ts +1 -1
- package/types/compile/viteCompilerContext.d.ts +128 -0
- package/types/global.d.ts +9 -8
- package/types/index.d.ts +9 -7
- package/types/taro.api.d.ts +11 -1
- package/types/taro.component.d.ts +3 -2
- package/types/taro.config.d.ts +122 -2
- package/types/taro.extend.d.ts +0 -112
|
@@ -15,6 +15,42 @@ declare module '../../index' {
|
|
|
15
15
|
response: string
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
namespace tradePay {
|
|
19
|
+
interface Option {
|
|
20
|
+
/** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
|
|
21
|
+
tradeNO?: string
|
|
22
|
+
/** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
|
|
23
|
+
orderStr?: string
|
|
24
|
+
/** 接口调用成功的回调函数 */
|
|
25
|
+
success?: (res: SuccessCallbackResult) => void
|
|
26
|
+
/** 接口调用失败的回调函数 */
|
|
27
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
28
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
29
|
+
complete?:(res: TaroGeneral.CallbackResult) => void
|
|
30
|
+
}
|
|
31
|
+
interface ResultCode {
|
|
32
|
+
/** 无权限调用(N22104) */
|
|
33
|
+
4
|
|
34
|
+
/** 订单处理成功 */
|
|
35
|
+
9000
|
|
36
|
+
/** 正在处理中。支付结果未知(有可能已经支付成功) */
|
|
37
|
+
8000
|
|
38
|
+
/** 订单处理失败 */
|
|
39
|
+
4000
|
|
40
|
+
/** 用户中途取消 */
|
|
41
|
+
6001
|
|
42
|
+
/** 网络连接出错 */
|
|
43
|
+
6002
|
|
44
|
+
/** 处理结果未知(有可能已经成功) */
|
|
45
|
+
6004
|
|
46
|
+
}
|
|
47
|
+
interface SuccessCallbackResult {
|
|
48
|
+
/** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
|
|
49
|
+
response: {
|
|
50
|
+
resultCode: ResultCode
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
18
54
|
interface TaroStatic {
|
|
19
55
|
/**
|
|
20
56
|
* 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
|
|
@@ -22,5 +58,12 @@ declare module '../../index' {
|
|
|
22
58
|
* @see https://docs.alipay.com/mini/api/ch8chh
|
|
23
59
|
*/
|
|
24
60
|
getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
|
|
64
|
+
* @supported alipay
|
|
65
|
+
* @see https://opendocs.alipay.com/mini/api/openapi-pay
|
|
66
|
+
*/
|
|
67
|
+
tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
|
|
25
68
|
}
|
|
26
69
|
}
|
|
@@ -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,14 +35,14 @@ 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 {
|
|
42
42
|
namespace getLatestUserKey {
|
|
43
43
|
interface Option {
|
|
44
44
|
/** 接口调用成功的回调函数 */
|
|
45
|
-
success?: (res:
|
|
45
|
+
success?: (res: SuccessCallbackResult) => void
|
|
46
46
|
/** 接口调用失败的回调函数 */
|
|
47
47
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
48
48
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -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
|
*/
|
|
@@ -32,7 +32,7 @@ declare module '../../index' {
|
|
|
32
32
|
* @supported weapp
|
|
33
33
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html
|
|
34
34
|
*/
|
|
35
|
-
createObserver(callback:
|
|
35
|
+
createObserver(callback: TaroGeneral.TFunc): PerformanceObserver
|
|
36
36
|
/** 该方法返回当前缓冲区中的所有性能数据
|
|
37
37
|
* @supported weapp, tt
|
|
38
38
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html
|
|
@@ -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,8 +220,25 @@ 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
|
* **注意**
|
|
180
243
|
* - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) `时,evaluateScript` 将仅包含公有部分代码,页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
|
|
181
244
|
* - `firstPaint` 和 `firstContentfulPaint` 指标在开启 `vconsole` 的情况下,由于绘制 `vconsoel` 的面板,会导致数据提前。
|
|
@@ -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
|
}
|