@tarojs/taro 3.5.0-alpha.15 → 3.5.0-alpha.16
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/index.js +3 -4
- package/package.json +7 -8
- package/types/api/base/debug.d.ts +1 -1
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/base/system.d.ts +2 -2
- package/types/api/base/update.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +56 -17
- package/types/api/base/weapp/life-cycle.d.ts +7 -7
- package/types/api/canvas/index.d.ts +1 -1
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/calendar.d.ts +1 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +3 -3
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/keyboard.d.ts +1 -1
- package/types/api/device/memory.d.ts +1 -1
- package/types/api/device/network.d.ts +2 -2
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +5 -5
- package/types/api/device/vibrate.d.ts +6 -2
- package/types/api/device/wifi.d.ts +3 -3
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +32 -32
- package/types/api/framework/index.d.ts +5 -4
- package/types/api/location/index.d.ts +45 -9
- package/types/api/media/audio.d.ts +1 -1
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +8 -8
- package/types/api/media/image.d.ts +5 -5
- package/types/api/media/map.d.ts +15 -15
- package/types/api/media/recorder.d.ts +9 -9
- package/types/api/media/video.d.ts +2 -2
- package/types/api/navigate/index.d.ts +2 -2
- package/types/api/network/download.d.ts +27 -8
- package/types/api/network/request.d.ts +3 -3
- package/types/api/network/upload.d.ts +19 -8
- package/types/api/network/websocket.d.ts +6 -6
- package/types/api/open-api/address.d.ts +1 -1
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/settings.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +2 -2
- package/types/api/open-api/user-info.d.ts +2 -2
- package/types/api/route/index.d.ts +5 -5
- package/types/api/share/index.d.ts +2 -2
- package/types/api/storage/index.d.ts +10 -10
- package/types/api/ui/animation.d.ts +34 -36
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +5 -5
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +4 -2
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/wxml/index.d.ts +16 -16
- package/types/compile.d.ts +18 -4
- package/types/global.d.ts +1 -1
- package/types/taro.component.d.ts +12 -63
- package/types/taro.config.d.ts +29 -0
- package/types/taro.extend.d.ts +24 -20
- package/types/taro.hooks.d.ts +55 -3
- package/types/taro.lifecycle.d.ts +21 -14
- package/LICENSE +0 -21
package/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { hooks } = require('@tarojs/runtime')
|
|
2
2
|
const taro = require('@tarojs/api').default
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
hooks.initNativeApi(taro)
|
|
4
|
+
if (hooks.isExist('initNativeApi')) {
|
|
5
|
+
hooks.call('initNativeApi', taro)
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
module.exports = taro
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.5.0-alpha.
|
|
3
|
+
"version": "3.5.0-alpha.16",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"html.css",
|
|
12
12
|
"html5.css"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
16
|
-
},
|
|
17
14
|
"repository": {
|
|
18
15
|
"type": "git",
|
|
19
16
|
"url": "git+https://github.com/NervJS/taro.git"
|
|
@@ -24,8 +21,8 @@
|
|
|
24
21
|
"author": "O2Team",
|
|
25
22
|
"license": "MIT",
|
|
26
23
|
"dependencies": {
|
|
27
|
-
"@tarojs/api": "3.5.0-alpha.
|
|
28
|
-
"@tarojs/runtime": "3.5.0-alpha.
|
|
24
|
+
"@tarojs/api": "3.5.0-alpha.16",
|
|
25
|
+
"@tarojs/runtime": "3.5.0-alpha.16"
|
|
29
26
|
},
|
|
30
27
|
"peerDependenciesMeta": {
|
|
31
28
|
"@types/react": {
|
|
@@ -41,5 +38,7 @@
|
|
|
41
38
|
"optional": true
|
|
42
39
|
}
|
|
43
40
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -3,7 +3,7 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
interface TaroStatic {
|
|
5
5
|
/** 判断小程序的 API,回调,参数,组件等是否在当前版本可用。
|
|
6
|
-
* @supported weapp
|
|
6
|
+
* @supported weapp, tt
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
9
|
* Taro.canIUse('openBluetoothAdapter')
|
|
@@ -44,7 +44,7 @@ declare module '../../index' {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* 将 Base64 字符串转成 ArrayBuffer 数据。
|
|
47
|
-
* @supported weapp, h5, rn
|
|
47
|
+
* @supported weapp, h5, rn, tt
|
|
48
48
|
* @example
|
|
49
49
|
* ```tsx
|
|
50
50
|
* const base64 = 'CxYh'
|
|
@@ -59,7 +59,7 @@ declare module '../../index' {
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* 将 ArrayBuffer 数据转成 Base64 字符串。
|
|
62
|
-
* @supported weapp, h5, rn
|
|
62
|
+
* @supported weapp, h5, rn, tt
|
|
63
63
|
* @example
|
|
64
64
|
* ```tsx
|
|
65
65
|
* const arrayBuffer = new Uint8Array([11, 22, 33])
|
|
@@ -24,7 +24,7 @@ declare module '../../index' {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** Performance 对象,用于获取性能数据及创建性能监听器
|
|
27
|
-
* @supported weapp
|
|
27
|
+
* @supported weapp, tt
|
|
28
28
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.html
|
|
29
29
|
*/
|
|
30
30
|
interface Performance {
|
|
@@ -34,17 +34,17 @@ declare module '../../index' {
|
|
|
34
34
|
*/
|
|
35
35
|
createObserver(callback: Function): PerformanceObserver
|
|
36
36
|
/** 该方法返回当前缓冲区中的所有性能数据
|
|
37
|
-
* @supported weapp
|
|
37
|
+
* @supported weapp, tt
|
|
38
38
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html
|
|
39
39
|
*/
|
|
40
40
|
getEntries(): PerformanceEntry[]
|
|
41
41
|
/** 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据
|
|
42
|
-
* @supported weapp
|
|
42
|
+
* @supported weapp, tt
|
|
43
43
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByName.html
|
|
44
44
|
*/
|
|
45
45
|
getEntriesByName(name: string, entryType: string): PerformanceEntry[]
|
|
46
46
|
/** 获取当前缓冲区中所有类型为 [entryType] 的性能数据
|
|
47
|
-
* @supported weapp
|
|
47
|
+
* @supported weapp, tt
|
|
48
48
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByType.html
|
|
49
49
|
*/
|
|
50
50
|
getEntriesByType(entryType: string): PerformanceEntry[]
|
|
@@ -179,7 +179,7 @@ declare module '../../index' {
|
|
|
179
179
|
* **注意**
|
|
180
180
|
* - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) `时,evaluateScript` 将仅包含公有部分代码,页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
|
|
181
181
|
* - `firstPaint` 和 `firstContentfulPaint` 指标在开启 `vconsole` 的情况下,由于绘制 `vconsoel` 的面板,会导致数据提前。
|
|
182
|
-
* @supported weapp
|
|
182
|
+
* @supported weapp, tt
|
|
183
183
|
* @example
|
|
184
184
|
* ```tsx
|
|
185
185
|
* const performance = Taro.getPerformance()
|
|
@@ -498,7 +498,7 @@ declare module '../../index' {
|
|
|
498
498
|
getSystemSetting(): getSystemSetting.Result
|
|
499
499
|
|
|
500
500
|
/** [Taro.getSystemInfo](./getSystemInfo) 的同步版本
|
|
501
|
-
* @supported weapp, h5, rn
|
|
501
|
+
* @supported weapp, h5, rn, tt
|
|
502
502
|
* @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
|
|
503
503
|
* @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
|
|
504
504
|
* @example
|
|
@@ -543,7 +543,7 @@ declare module '../../index' {
|
|
|
543
543
|
getSystemInfoAsync(res?: getSystemInfoAsync.Option): Promise<getSystemInfo.Result>
|
|
544
544
|
|
|
545
545
|
/** 获取系统信息,支持 `Promise` 化使用。
|
|
546
|
-
* @supported weapp, h5, rn
|
|
546
|
+
* @supported weapp, h5, rn, tt
|
|
547
547
|
* @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
|
|
548
548
|
* @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
|
|
549
549
|
* @example
|
|
@@ -28,7 +28,7 @@ declare module '../../index' {
|
|
|
28
28
|
* **Tips**
|
|
29
29
|
* - 微信开发者工具上可以通过「编译模式」下的「下次编译模拟更新」开关来调试
|
|
30
30
|
* - 小程序开发版/体验版没有「版本」概念,所以无法在开发版/体验版上测试更版本更新情况
|
|
31
|
-
* @supported weapp
|
|
31
|
+
* @supported weapp, tt
|
|
32
32
|
* @example
|
|
33
33
|
* ```tsx
|
|
34
34
|
* const updateManager = Taro.getUpdateManager()
|
|
@@ -59,12 +59,12 @@ declare module '../../index' {
|
|
|
59
59
|
*/
|
|
60
60
|
interface UpdateManager {
|
|
61
61
|
/** 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。
|
|
62
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp, tt
|
|
63
63
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html
|
|
64
64
|
*/
|
|
65
65
|
applyUpdate(): void
|
|
66
66
|
/** 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。
|
|
67
|
-
* @supported weapp
|
|
67
|
+
* @supported weapp, tt
|
|
68
68
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html
|
|
69
69
|
*/
|
|
70
70
|
onCheckForUpdate(
|
|
@@ -72,7 +72,7 @@ declare module '../../index' {
|
|
|
72
72
|
callback: UpdateManager.OnCheckForUpdateCallback,
|
|
73
73
|
): void
|
|
74
74
|
/** 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
|
|
75
|
-
* @supported weapp
|
|
75
|
+
* @supported weapp, tt
|
|
76
76
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html
|
|
77
77
|
*/
|
|
78
78
|
onUpdateReady(
|
|
@@ -80,7 +80,7 @@ declare module '../../index' {
|
|
|
80
80
|
callback: (res: TaroGeneral.CallbackResult) => void,
|
|
81
81
|
): void
|
|
82
82
|
/** 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
|
|
83
|
-
* @supported weapp
|
|
83
|
+
* @supported weapp, tt
|
|
84
84
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html
|
|
85
85
|
*/
|
|
86
86
|
onUpdateFailed(
|
|
@@ -122,7 +122,7 @@ declare module '../../index' {
|
|
|
122
122
|
* // 新的版本下载失败
|
|
123
123
|
* })
|
|
124
124
|
* ```
|
|
125
|
-
* @supported weapp
|
|
125
|
+
* @supported weapp, tt
|
|
126
126
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html
|
|
127
127
|
*/
|
|
128
128
|
getUpdateManager(): UpdateManager
|
|
@@ -28,19 +28,58 @@ declare module '../../../index' {
|
|
|
28
28
|
path: string
|
|
29
29
|
/** 小程序切前台的 query 参数 */
|
|
30
30
|
query: TaroGeneral.IAnyObject
|
|
31
|
-
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
32
|
-
referrerInfo: ResultReferrerInfo
|
|
33
|
-
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
-
scene: number
|
|
35
31
|
/** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
36
32
|
shareTicket: string
|
|
33
|
+
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
+
scene: number
|
|
35
|
+
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
36
|
+
referrerInfo: ResultReferrerInfo
|
|
37
|
+
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
|
|
38
|
+
forwardMaterials?: ForwardMaterial[]
|
|
39
|
+
/** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型 */
|
|
40
|
+
chatType?: keyof ChatType
|
|
41
|
+
/** API 类别 */
|
|
42
|
+
apiCategory?: keyof ApiCategory
|
|
37
43
|
}
|
|
38
44
|
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
39
45
|
interface ResultReferrerInfo {
|
|
40
46
|
/** 来源小程序、公众号或 App 的 appId */
|
|
41
|
-
appId
|
|
47
|
+
appId?: string
|
|
42
48
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
43
|
-
extraData
|
|
49
|
+
extraData?: TaroGeneral.IAnyObject
|
|
50
|
+
}
|
|
51
|
+
/** ChatType 类型合法值 */
|
|
52
|
+
interface ForwardMaterial {
|
|
53
|
+
/** 文件的mimetype类型 */
|
|
54
|
+
type: string
|
|
55
|
+
/** 文件名 */
|
|
56
|
+
name: string
|
|
57
|
+
/** 文件路径(如果是webview则是url) */
|
|
58
|
+
path: string
|
|
59
|
+
/** 文件大小 */
|
|
60
|
+
size: number
|
|
61
|
+
}
|
|
62
|
+
/** ChatType 类型合法值 */
|
|
63
|
+
interface ChatType {
|
|
64
|
+
/** 微信联系人单聊 */
|
|
65
|
+
1
|
|
66
|
+
/** 企业微信联系人单聊 */
|
|
67
|
+
2
|
|
68
|
+
/** 普通微信群聊 */
|
|
69
|
+
3
|
|
70
|
+
/** 企业微信互通群聊 */
|
|
71
|
+
4
|
|
72
|
+
}
|
|
73
|
+
/** API 类别合法值 */
|
|
74
|
+
interface ApiCategory {
|
|
75
|
+
/** 默认类别 */
|
|
76
|
+
default
|
|
77
|
+
/** 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序 */
|
|
78
|
+
nativeFunctionalized
|
|
79
|
+
/** 仅浏览,朋友圈快照页等场景打开的小程序 */
|
|
80
|
+
browseOnly
|
|
81
|
+
/** 内嵌,通过打开半屏小程序能力打开的小程序 */
|
|
82
|
+
embedded
|
|
44
83
|
}
|
|
45
84
|
}
|
|
46
85
|
|
|
@@ -71,10 +110,10 @@ declare module '../../../index' {
|
|
|
71
110
|
|
|
72
111
|
interface TaroStatic {
|
|
73
112
|
/** 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
|
|
74
|
-
*
|
|
113
|
+
*
|
|
75
114
|
* **注意**
|
|
76
115
|
* - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
|
|
77
|
-
* @supported weapp
|
|
116
|
+
* @supported weapp, tt
|
|
78
117
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html
|
|
79
118
|
*/
|
|
80
119
|
onUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
|
|
@@ -92,13 +131,13 @@ declare module '../../../index' {
|
|
|
92
131
|
* - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
|
|
93
132
|
* - 若开发者没有调用 [Taro.onPageNotFound](/docs/apis/base/weapp/app-event/onPageNotFound) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
|
|
94
133
|
* - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。
|
|
95
|
-
* @supported weapp, h5
|
|
134
|
+
* @supported weapp, h5, tt
|
|
96
135
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html
|
|
97
136
|
*/
|
|
98
137
|
onPageNotFound(callback: onPageNotFound.Callback): void
|
|
99
138
|
|
|
100
139
|
/** 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
|
|
101
|
-
* @supported weapp
|
|
140
|
+
* @supported weapp, tt
|
|
102
141
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
|
|
103
142
|
*/
|
|
104
143
|
onError(callback: onError.Callback): void
|
|
@@ -139,7 +178,7 @@ declare module '../../../index' {
|
|
|
139
178
|
* **注意**
|
|
140
179
|
*
|
|
141
180
|
* 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
|
|
142
|
-
* @supported weapp
|
|
181
|
+
* @supported weapp, h5, tt
|
|
143
182
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html
|
|
144
183
|
*/
|
|
145
184
|
onAppShow(
|
|
@@ -148,7 +187,7 @@ declare module '../../../index' {
|
|
|
148
187
|
): void
|
|
149
188
|
|
|
150
189
|
/** 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
|
|
151
|
-
* @supported weapp
|
|
190
|
+
* @supported weapp, h5, tt
|
|
152
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html
|
|
153
192
|
*/
|
|
154
193
|
onAppHide(
|
|
@@ -157,7 +196,7 @@ declare module '../../../index' {
|
|
|
157
196
|
): void
|
|
158
197
|
|
|
159
198
|
/** 取消监听未处理的 Promise 拒绝事件
|
|
160
|
-
* @supported weapp
|
|
199
|
+
* @supported weapp, tt
|
|
161
200
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html
|
|
162
201
|
*/
|
|
163
202
|
offUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
|
|
@@ -169,7 +208,7 @@ declare module '../../../index' {
|
|
|
169
208
|
offThemeChange(callback: onThemeChange.Callback): void
|
|
170
209
|
|
|
171
210
|
/** 取消监听小程序要打开的页面不存在事件
|
|
172
|
-
* @supported weapp
|
|
211
|
+
* @supported weapp, tt
|
|
173
212
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html
|
|
174
213
|
*/
|
|
175
214
|
offPageNotFound(
|
|
@@ -178,7 +217,7 @@ declare module '../../../index' {
|
|
|
178
217
|
): void
|
|
179
218
|
|
|
180
219
|
/** 取消监听音频播放错误事件
|
|
181
|
-
* @supported weapp
|
|
220
|
+
* @supported weapp, tt
|
|
182
221
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html
|
|
183
222
|
*/
|
|
184
223
|
|
|
@@ -206,7 +245,7 @@ declare module '../../../index' {
|
|
|
206
245
|
): void
|
|
207
246
|
|
|
208
247
|
/** 取消监听小程序切前台事件
|
|
209
|
-
* @supported weapp
|
|
248
|
+
* @supported weapp, h5, tt
|
|
210
249
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html
|
|
211
250
|
*/
|
|
212
251
|
offAppShow(
|
|
@@ -215,7 +254,7 @@ declare module '../../../index' {
|
|
|
215
254
|
): void
|
|
216
255
|
|
|
217
256
|
/** 取消监听小程序切后台事件
|
|
218
|
-
* @supported weapp
|
|
257
|
+
* @supported weapp, h5, tt
|
|
219
258
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html
|
|
220
259
|
*/
|
|
221
260
|
offAppHide(
|
|
@@ -21,14 +21,14 @@ declare module '../../../index' {
|
|
|
21
21
|
/** API 类别 */
|
|
22
22
|
apiCategory?: keyof LaunchOptions.ApiCategory
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
namespace LaunchOptions {
|
|
26
26
|
/** 来源信息 */
|
|
27
27
|
interface ReferrerInfo {
|
|
28
28
|
/** 来源小程序、公众号或 App 的 appId */
|
|
29
|
-
appId
|
|
29
|
+
appId?: string
|
|
30
30
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
31
|
-
extraData
|
|
31
|
+
extraData?: TaroGeneral.IAnyObject
|
|
32
32
|
}
|
|
33
33
|
/** ChatType 类型合法值 */
|
|
34
34
|
interface ForwardMaterial {
|
|
@@ -86,14 +86,14 @@ declare module '../../../index' {
|
|
|
86
86
|
/** API 类别 */
|
|
87
87
|
apiCategory?: keyof EnterOptions.ApiCategory
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
namespace EnterOptions {
|
|
91
91
|
/** 来源信息 */
|
|
92
92
|
interface ReferrerInfo {
|
|
93
93
|
/** 来源小程序、公众号或 App 的 appId */
|
|
94
|
-
appId
|
|
94
|
+
appId?: string
|
|
95
95
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
96
|
-
extraData
|
|
96
|
+
extraData?: TaroGeneral.IAnyObject
|
|
97
97
|
}
|
|
98
98
|
/** ChatType 类型合法值 */
|
|
99
99
|
interface ForwardMaterial {
|
|
@@ -137,7 +137,7 @@ declare module '../../../index' {
|
|
|
137
137
|
*
|
|
138
138
|
* **注意**
|
|
139
139
|
* 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
|
|
140
|
-
* @supported weapp
|
|
140
|
+
* @supported weapp, tt
|
|
141
141
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html
|
|
142
142
|
*/
|
|
143
143
|
getLaunchOptionsSync(): getLaunchOptionsSync.LaunchOptions
|
|
@@ -4,7 +4,7 @@ declare module '../../index' {
|
|
|
4
4
|
namespace canvasToTempFilePath {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
|
|
7
|
-
canvas?:
|
|
7
|
+
canvas?: Canvas
|
|
8
8
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
|
|
9
9
|
canvasId?: string
|
|
10
10
|
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
@@ -56,7 +56,7 @@ declare module '../../index' {
|
|
|
56
56
|
* ```tsx
|
|
57
57
|
* Taro.startAccelerometer({ interval: 'game' })
|
|
58
58
|
* ```
|
|
59
|
-
* @supported weapp, h5, rn
|
|
59
|
+
* @supported weapp, h5, rn, tt
|
|
60
60
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html
|
|
61
61
|
*/
|
|
62
62
|
startAccelerometer (res?: startAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -67,14 +67,14 @@ declare module '../../index' {
|
|
|
67
67
|
* ```tsx
|
|
68
68
|
* Taro.stopAccelerometer()
|
|
69
69
|
* ```
|
|
70
|
-
* @supported weapp, h5, rn
|
|
70
|
+
* @supported weapp, h5, rn, tt
|
|
71
71
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html
|
|
72
72
|
*/
|
|
73
73
|
stopAccelerometer (res?: stopAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。
|
|
77
|
-
* @supported weapp, h5, rn
|
|
77
|
+
* @supported weapp, h5, rn, tt
|
|
78
78
|
* @example
|
|
79
79
|
* ```tsx
|
|
80
80
|
* Taro.onAccelerometerChange(res => {
|
|
@@ -80,7 +80,7 @@ declare module '../../index' {
|
|
|
80
80
|
*/
|
|
81
81
|
addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
82
82
|
/** 向系统日历添加事件
|
|
83
|
-
* @supported weapp
|
|
83
|
+
* @supported weapp, tt
|
|
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>
|
|
@@ -43,7 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
|
|
44
44
|
interface TaroStatic {
|
|
45
45
|
/** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
|
|
46
|
-
* @supported weapp, h5, rn
|
|
46
|
+
* @supported weapp, h5, rn, tt
|
|
47
47
|
* @h5 部分实现
|
|
48
48
|
* @example
|
|
49
49
|
* ```tsx
|
|
@@ -64,7 +64,7 @@ declare module '../../index' {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* 获取系统剪贴板内容
|
|
67
|
-
* @supported weapp, h5, rn
|
|
67
|
+
* @supported weapp, h5, rn, tt
|
|
68
68
|
* @h5 部分实现
|
|
69
69
|
* @example
|
|
70
70
|
* ```tsx
|
|
@@ -59,7 +59,7 @@ declare module '../../index' {
|
|
|
59
59
|
|
|
60
60
|
interface TaroStatic {
|
|
61
61
|
/** 停止监听罗盘数据
|
|
62
|
-
* @supported weapp, h5
|
|
62
|
+
* @supported weapp, h5, tt
|
|
63
63
|
* @example
|
|
64
64
|
* ```tsx
|
|
65
65
|
* Taro.stopCompass()
|
|
@@ -69,7 +69,7 @@ declare module '../../index' {
|
|
|
69
69
|
stopCompass(option?: stopCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
70
70
|
|
|
71
71
|
/** 开始监听罗盘数据
|
|
72
|
-
* @supported weapp, h5
|
|
72
|
+
* @supported weapp, h5, tt
|
|
73
73
|
* @example
|
|
74
74
|
* ```js
|
|
75
75
|
* Taro.startCompass()
|
|
@@ -79,7 +79,7 @@ declare module '../../index' {
|
|
|
79
79
|
startCompass(option?: startCompass.Option): Promise<TaroGeneral.CallbackResult>
|
|
80
80
|
|
|
81
81
|
/** 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 Taro.stopCompass 停止监听。
|
|
82
|
-
* @supported weapp, h5
|
|
82
|
+
* @supported weapp, h5, tt
|
|
83
83
|
* @example
|
|
84
84
|
* ```tsx
|
|
85
85
|
* Taro.onCompassChange(function (res) {
|
|
@@ -53,19 +53,19 @@ declare module '../../index' {
|
|
|
53
53
|
|
|
54
54
|
interface TaroStatic {
|
|
55
55
|
/** 停止监听陀螺仪数据。
|
|
56
|
-
* @supported weapp, rn
|
|
56
|
+
* @supported weapp, rn, tt
|
|
57
57
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html
|
|
58
58
|
*/
|
|
59
59
|
stopGyroscope(option?: stopGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
60
60
|
|
|
61
61
|
/** 开始监听陀螺仪数据。
|
|
62
|
-
* @supported weapp, rn
|
|
62
|
+
* @supported weapp, rn, tt
|
|
63
63
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html
|
|
64
64
|
*/
|
|
65
65
|
startGyroscope(option: startGyroscope.Option): Promise<TaroGeneral.CallbackResult>
|
|
66
66
|
|
|
67
67
|
/** 监听陀螺仪数据变化事件。频率根据 Taro.startGyroscope() 的 interval 参数。可以使用 Taro.stopGyroscope() 停止监听。
|
|
68
|
-
* @supported weapp, rn
|
|
68
|
+
* @supported weapp, rn, tt
|
|
69
69
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html
|
|
70
70
|
*/
|
|
71
71
|
onGyroscopeChange(
|
|
@@ -74,7 +74,7 @@ declare module '../../index' {
|
|
|
74
74
|
): void
|
|
75
75
|
|
|
76
76
|
/** 取消监听陀螺仪数据变化事件。
|
|
77
|
-
* @supported weapp, rn
|
|
77
|
+
* @supported weapp, rn, tt
|
|
78
78
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html
|
|
79
79
|
*/
|
|
80
80
|
offGyroscopeChange(
|
|
@@ -26,7 +26,7 @@ declare module '../../index' {
|
|
|
26
26
|
/** 监听内存不足告警事件。
|
|
27
27
|
*
|
|
28
28
|
* 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
|
|
29
|
-
* @supported weapp
|
|
29
|
+
* @supported weapp, tt
|
|
30
30
|
* @example
|
|
31
31
|
* ```tsx
|
|
32
32
|
* Taro.onMemoryWarning(function () {
|
|
@@ -101,7 +101,7 @@ declare module '../../index' {
|
|
|
101
101
|
): void
|
|
102
102
|
|
|
103
103
|
/** 监听网络状态变化。
|
|
104
|
-
* @supported weapp, h5, rn
|
|
104
|
+
* @supported weapp, h5, rn, tt
|
|
105
105
|
* @example
|
|
106
106
|
* ```tsx
|
|
107
107
|
* Taro.onNetworkStatusChange(function (res) {
|
|
@@ -135,7 +135,7 @@ declare module '../../index' {
|
|
|
135
135
|
): void
|
|
136
136
|
|
|
137
137
|
/** 获取网络类型。
|
|
138
|
-
* @supported weapp, h5, rn
|
|
138
|
+
* @supported weapp, h5, rn, tt
|
|
139
139
|
* @example
|
|
140
140
|
* ```tsx
|
|
141
141
|
* Taro.getNetworkType({
|
|
@@ -77,7 +77,7 @@ declare module '../../index' {
|
|
|
77
77
|
setVisualEffectOnCapture(option: setVisualEffectOnCapture.Option): Promise<TaroGeneral.CallbackResult>
|
|
78
78
|
|
|
79
79
|
/** 设置屏幕亮度。
|
|
80
|
-
* @supported weapp, rn
|
|
80
|
+
* @supported weapp, rn, tt
|
|
81
81
|
* @example
|
|
82
82
|
* ```tsx
|
|
83
83
|
* Taro.setScreenBrightness(params).then(...)
|
|
@@ -88,7 +88,7 @@ declare module '../../index' {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
|
|
91
|
-
* @supported weapp, rn
|
|
91
|
+
* @supported weapp, rn, tt
|
|
92
92
|
* @example
|
|
93
93
|
* ```tsx
|
|
94
94
|
* // 保持屏幕常亮
|
|
@@ -102,7 +102,7 @@ declare module '../../index' {
|
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件
|
|
105
|
-
* @supported weapp
|
|
105
|
+
* @supported weapp, tt
|
|
106
106
|
* @example
|
|
107
107
|
* ```tsx
|
|
108
108
|
* Taro.onUserCaptureScreen(function (res) {
|
|
@@ -117,7 +117,7 @@ declare module '../../index' {
|
|
|
117
117
|
): void
|
|
118
118
|
|
|
119
119
|
/** 用户主动截屏事件。取消事件监听。
|
|
120
|
-
* @supported weapp
|
|
120
|
+
* @supported weapp, tt
|
|
121
121
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
|
|
122
122
|
*/
|
|
123
123
|
offUserCaptureScreen(
|
|
@@ -130,7 +130,7 @@ declare module '../../index' {
|
|
|
130
130
|
*
|
|
131
131
|
* **说明**
|
|
132
132
|
* - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
|
|
133
|
-
* @supported weapp, rn
|
|
133
|
+
* @supported weapp, rn, tt
|
|
134
134
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html
|
|
135
135
|
*/
|
|
136
136
|
getScreenBrightness(
|