@tarojs/taro 3.5.0-canary.1 → 3.5.0

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.
Files changed (109) hide show
  1. package/html.css +50 -14
  2. package/html5.css +167 -64
  3. package/index.js +3 -4
  4. package/package.json +21 -11
  5. package/types/api/ad/index.d.ts +2 -2
  6. package/types/api/ai/face.d.ts +133 -0
  7. package/types/api/ai/visionkit.d.ts +303 -0
  8. package/types/api/base/crypto.d.ts +90 -0
  9. package/types/api/base/debug.d.ts +152 -13
  10. package/types/api/base/env.d.ts +2 -1
  11. package/types/api/base/index.d.ts +11 -3
  12. package/types/api/base/performance.d.ts +195 -0
  13. package/types/api/base/system.d.ts +541 -103
  14. package/types/api/base/update.d.ts +60 -8
  15. package/types/api/base/weapp/app-event.d.ts +99 -37
  16. package/types/api/base/weapp/life-cycle.d.ts +142 -2
  17. package/types/api/canvas/index.d.ts +151 -137
  18. package/types/api/cloud/index.d.ts +17 -2
  19. package/types/api/data-analysis/index.d.ts +1 -1
  20. package/types/api/device/accelerometer.d.ts +6 -6
  21. package/types/api/device/accessibility.d.ts +26 -0
  22. package/types/api/device/battery.d.ts +2 -2
  23. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  24. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  25. package/types/api/device/bluetooth.d.ts +67 -2
  26. package/types/api/device/calendar.d.ts +88 -0
  27. package/types/api/device/clipboard.d.ts +2 -2
  28. package/types/api/device/compass.d.ts +3 -3
  29. package/types/api/device/contact.d.ts +74 -50
  30. package/types/api/device/gyroscope.d.ts +6 -6
  31. package/types/api/device/iBeacon.d.ts +33 -19
  32. package/types/api/{ui → device}/keyboard.d.ts +1 -1
  33. package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
  34. package/types/api/device/motion.d.ts +3 -3
  35. package/types/api/device/network.d.ts +56 -15
  36. package/types/api/device/nfc.d.ts +1089 -13
  37. package/types/api/device/phone.d.ts +1 -1
  38. package/types/api/device/scan.d.ts +1 -1
  39. package/types/api/device/screen.d.ts +42 -14
  40. package/types/api/device/vibrate.d.ts +6 -2
  41. package/types/api/device/wifi.d.ts +44 -9
  42. package/types/api/ext/index.d.ts +2 -2
  43. package/types/api/files/index.d.ts +392 -205
  44. package/types/api/framework/index.d.ts +5 -4
  45. package/types/api/location/index.d.ts +156 -53
  46. package/types/api/media/audio.d.ts +629 -38
  47. package/types/api/media/background-audio.d.ts +9 -9
  48. package/types/api/media/camera.d.ts +41 -22
  49. package/types/api/media/editor.d.ts +22 -2
  50. package/types/api/media/image.d.ts +64 -35
  51. package/types/api/media/live.d.ts +66 -6
  52. package/types/api/media/map.d.ts +474 -54
  53. package/types/api/media/media-recorder.d.ts +92 -0
  54. package/types/api/media/recorder.d.ts +21 -21
  55. package/types/api/media/video-decoder.d.ts +117 -0
  56. package/types/api/media/video-processing.d.ts +11 -7
  57. package/types/api/media/video.d.ts +47 -18
  58. package/types/api/media/voip.d.ts +290 -0
  59. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
  60. package/types/api/network/download.d.ts +61 -19
  61. package/types/api/network/request.d.ts +129 -41
  62. package/types/api/network/tcp.d.ts +181 -0
  63. package/types/api/network/udp.d.ts +154 -83
  64. package/types/api/network/upload.d.ts +55 -28
  65. package/types/api/network/websocket.d.ts +20 -19
  66. package/types/api/open-api/address.d.ts +1 -1
  67. package/types/api/open-api/authorize.d.ts +42 -3
  68. package/types/api/open-api/channels.d.ts +178 -0
  69. package/types/api/open-api/facial.d.ts +3 -0
  70. package/types/api/open-api/favorites.d.ts +100 -0
  71. package/types/api/open-api/group.d.ts +59 -0
  72. package/types/api/open-api/invoice.d.ts +2 -2
  73. package/types/api/open-api/license-plate.d.ts +27 -0
  74. package/types/api/open-api/login.d.ts +21 -0
  75. package/types/api/open-api/redpackage.d.ts +24 -0
  76. package/types/api/open-api/settings.d.ts +82 -17
  77. package/types/api/open-api/soter.d.ts +2 -2
  78. package/types/api/open-api/subscribe-message.d.ts +89 -4
  79. package/types/api/open-api/user-info.d.ts +56 -19
  80. package/types/api/open-api/werun.d.ts +33 -6
  81. package/types/api/payment/index.d.ts +119 -0
  82. package/types/api/route/index.d.ts +18 -14
  83. package/types/api/share/index.d.ts +192 -9
  84. package/types/api/storage/index.d.ts +38 -92
  85. package/types/api/swan/index.d.ts +1 -1
  86. package/types/api/ui/animation.d.ts +105 -155
  87. package/types/api/ui/background.d.ts +4 -2
  88. package/types/api/ui/custom-component.d.ts +1 -1
  89. package/types/api/ui/fonts.d.ts +27 -31
  90. package/types/api/ui/interaction.d.ts +6 -6
  91. package/types/api/ui/menu.d.ts +1 -1
  92. package/types/api/ui/navigation-bar.d.ts +6 -5
  93. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  94. package/types/api/ui/scroll.d.ts +75 -7
  95. package/types/api/ui/sticky.d.ts +4 -4
  96. package/types/api/ui/tab-bar.d.ts +8 -8
  97. package/types/api/ui/window.d.ts +22 -2
  98. package/types/api/worker/index.d.ts +9 -1
  99. package/types/api/wxml/index.d.ts +116 -112
  100. package/types/compile.d.ts +57 -6
  101. package/types/global.d.ts +142 -111
  102. package/types/taro.api.d.ts +79 -62
  103. package/types/taro.component.d.ts +21 -65
  104. package/types/taro.config.d.ts +31 -0
  105. package/types/taro.extend.d.ts +31 -18
  106. package/types/taro.hooks.d.ts +55 -3
  107. package/types/taro.lifecycle.d.ts +21 -14
  108. package/LICENSE +0 -21
  109. package/types/api/open-api/payment.d.ts +0 -61
@@ -1,6 +1,17 @@
1
1
  import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
+ namespace updateWeChatApp {
5
+ interface Option {
6
+ /** 接口调用成功的回调函数 */
7
+ success?: (res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ }
13
+ }
14
+
4
15
  namespace UpdateManager {
5
16
  /** 向微信后台请求检查更新结果事件的回调函数 */
6
17
  type OnCheckForUpdateCallback = (
@@ -13,37 +24,78 @@ declare module '../../index' {
13
24
  }
14
25
 
15
26
  /** UpdateManager 对象,用来管理更新,可通过 Taro.getUpdateManager 接口获取实例。
27
+ *
28
+ * **Tips**
29
+ * - 微信开发者工具上可以通过「编译模式」下的「下次编译模拟更新」开关来调试
30
+ * - 小程序开发版/体验版没有「版本」概念,所以无法在开发版/体验版上测试更版本更新情况
31
+ * @supported weapp, tt
32
+ * @example
33
+ * ```tsx
34
+ * const updateManager = Taro.getUpdateManager()
35
+ *
36
+ * updateManager.onCheckForUpdate(function (res) {
37
+ * // 请求完新版本信息的回调
38
+ * console.log(res.hasUpdate)
39
+ * })
40
+ *
41
+ * updateManager.onUpdateReady(function () {
42
+ * wx.showModal({
43
+ * title: '更新提示',
44
+ * content: '新版本已经准备好,是否重启应用?',
45
+ * success: function (res) {
46
+ * if (res.confirm) {
47
+ * // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
48
+ * updateManager.applyUpdate()
49
+ * }
50
+ * }
51
+ * })
52
+ * })
53
+ *
54
+ * updateManager.onUpdateFailed(function () {
55
+ * // 新版本下载失败
56
+ * })
57
+ * ```
16
58
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html
17
59
  */
18
60
  interface UpdateManager {
19
61
  /** 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。
62
+ * @supported weapp, tt
20
63
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html
21
64
  */
22
65
  applyUpdate(): void
23
66
  /** 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。
67
+ * @supported weapp, tt
24
68
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html
25
69
  */
26
70
  onCheckForUpdate(
27
71
  /** 向微信后台请求检查更新结果事件的回调函数 */
28
72
  callback: UpdateManager.OnCheckForUpdateCallback,
29
73
  ): void
30
- /** 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
31
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html
32
- */
33
- onUpdateFailed(
34
- /** 小程序更新失败事件的回调函数 */
35
- callback: (res: TaroGeneral.CallbackResult) => void,
36
- ): void
37
74
  /** 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
75
+ * @supported weapp, tt
38
76
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html
39
77
  */
40
78
  onUpdateReady(
41
79
  /** 小程序有版本更新事件的回调函数 */
42
80
  callback: (res: TaroGeneral.CallbackResult) => void,
43
81
  ): void
82
+ /** 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
83
+ * @supported weapp, tt
84
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html
85
+ */
86
+ onUpdateFailed(
87
+ /** 小程序更新失败事件的回调函数 */
88
+ callback: (res: TaroGeneral.CallbackResult) => void,
89
+ ): void
44
90
  }
45
91
 
46
92
  interface TaroStatic {
93
+ /** 更新客户端版本。当判断用户小程序所在客户端版本过低时,可使用该接口跳转到更新微信页面。
94
+ * @supported weapp
95
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.updateWeChatApp.html
96
+ */
97
+ updateWeChatApp(option: updateWeChatApp.Option): Promise<TaroGeneral.CallbackResult>
98
+
47
99
  /**
48
100
  * 获取**全局唯一**的版本更新管理器,用于管理小程序更新。
49
101
  * 关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。
@@ -70,7 +122,7 @@ declare module '../../index' {
70
122
  * // 新的版本下载失败
71
123
  * })
72
124
  * ```
73
- * @supported weapp
125
+ * @supported weapp, tt
74
126
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html
75
127
  */
76
128
  getUpdateManager(): UpdateManager
@@ -9,7 +9,7 @@ declare module '../../../index' {
9
9
  path: string
10
10
  /** 打开不存在页面的 query 参数 */
11
11
  query: TaroGeneral.IAnyObject
12
- }
12
+ }
13
13
  /** 小程序要打开的页面不存在事件的回调函数 */
14
14
  type Callback = (res: Result) => void
15
15
  }
@@ -28,54 +28,116 @@ 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: string
47
+ appId?: string
42
48
  /** 来源小程序传过来的数据,scene=1037或1038时支持 */
43
- extraData: TaroGeneral.IAnyObject
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
 
47
- namespace themeChange {
86
+ namespace onUnhandledRejection {
87
+ type Callback<T = any> = (res: Result<T>) => void
88
+ type Result<T = any> = {
89
+ /** 拒绝原因,一般是一个 Error 对象 */
90
+ reason: string | Error
91
+ /** 被拒绝的 Promise 对象 */
92
+ promise: Promise<T>
93
+ }
94
+ }
95
+
96
+ namespace onThemeChange {
97
+ /** 系统主题改变事件的回调函数 */
98
+ type Callback = (res: Result) => void
99
+ interface Result {
100
+ /** 系统当前的主题,取值为`light`或`dark` */
101
+ theme: keyof ITheme
102
+ }
48
103
  interface ITheme {
49
104
  /** 浅色主题 */
50
105
  light
51
106
  /** 深色主题 */
52
107
  dark
53
108
  }
54
- interface onThemeChangeResult {
55
- /** 系统当前的主题,取值为`light`或`dark` */
56
- theme: keyof ITheme
57
- }
58
- /** 系统主题改变事件的回调函数 */
59
- type onThemeChangeCallback = (res: onThemeChangeResult) => void
60
- /** 系统主题改变事件的回调函数 */
61
- type offThemeChangeCallback = (res: TaroGeneral.CallbackResult) => void
62
109
  }
63
110
 
64
111
  interface TaroStatic {
112
+ /** 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
113
+ *
114
+ * **注意**
115
+ * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
116
+ * @supported weapp, tt
117
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html
118
+ */
119
+ onUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
120
+
121
+ /** 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
122
+ * @supported weapp
123
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html
124
+ */
125
+ onThemeChange(callback: onThemeChange.Callback): void
126
+
65
127
  /**
66
128
  * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。
67
129
  *
68
130
  * **注意**
69
131
  * - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
70
- * - 若开发者没有调用 [Taro.onPageNotFound](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
132
+ * - 若开发者没有调用 [Taro.onPageNotFound](/docs/apis/base/weapp/app-event/onPageNotFound) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
71
133
  * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。
72
- * @supported weapp, h5
134
+ * @supported weapp, h5, tt
73
135
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html
74
136
  */
75
137
  onPageNotFound(callback: onPageNotFound.Callback): void
76
138
 
77
139
  /** 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
78
- * @supported weapp
140
+ * @supported weapp, tt
79
141
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
80
142
  */
81
143
  onError(callback: onError.Callback): void
@@ -116,7 +178,7 @@ declare module '../../../index' {
116
178
  * **注意**
117
179
  *
118
180
  * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
119
- * @supported weapp
181
+ * @supported weapp, h5, tt
120
182
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html
121
183
  */
122
184
  onAppShow(
@@ -125,7 +187,7 @@ declare module '../../../index' {
125
187
  ): void
126
188
 
127
189
  /** 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
128
- * @supported weapp
190
+ * @supported weapp, h5, tt
129
191
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html
130
192
  */
131
193
  onAppHide(
@@ -133,8 +195,20 @@ declare module '../../../index' {
133
195
  callback: (res: onAppShow.CallbackResult) => void,
134
196
  ): void
135
197
 
136
- /** 取消监听小程序要打开的页面不存在事件
198
+ /** 取消监听未处理的 Promise 拒绝事件
199
+ * @supported weapp, tt
200
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html
201
+ */
202
+ offUnhandledRejection<T = any>(callback: onUnhandledRejection.Callback<T>): void
203
+
204
+ /** 取消监听系统主题改变事件
137
205
  * @supported weapp
206
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html
207
+ */
208
+ offThemeChange(callback: onThemeChange.Callback): void
209
+
210
+ /** 取消监听小程序要打开的页面不存在事件
211
+ * @supported weapp, tt
138
212
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html
139
213
  */
140
214
  offPageNotFound(
@@ -143,7 +217,7 @@ declare module '../../../index' {
143
217
  ): void
144
218
 
145
219
  /** 取消监听音频播放错误事件
146
- * @supported weapp
220
+ * @supported weapp, tt
147
221
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html
148
222
  */
149
223
 
@@ -171,7 +245,7 @@ declare module '../../../index' {
171
245
  ): void
172
246
 
173
247
  /** 取消监听小程序切前台事件
174
- * @supported weapp
248
+ * @supported weapp, h5, tt
175
249
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html
176
250
  */
177
251
  offAppShow(
@@ -180,24 +254,12 @@ declare module '../../../index' {
180
254
  ): void
181
255
 
182
256
  /** 取消监听小程序切后台事件
183
- * @supported weapp
257
+ * @supported weapp, h5, tt
184
258
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html
185
259
  */
186
260
  offAppHide(
187
261
  /** 小程序切后台事件的回调函数 */
188
262
  callback: (res: TaroGeneral.CallbackResult) => void,
189
263
  ): void
190
-
191
- /** 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
192
- * @supported weapp
193
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html
194
- */
195
- onThemeChange(callback: themeChange.onThemeChangeCallback): void
196
-
197
- /** 取消监听系统主题改变事件
198
- * @supported weapp
199
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html
200
- */
201
- offThemeChange(callback: themeChange.offThemeChangeCallback): void
202
264
  }
203
265
  }
@@ -1,15 +1,155 @@
1
1
  import Taro from '../../../index'
2
2
 
3
3
  declare module '../../../index' {
4
+ namespace getLaunchOptionsSync {
5
+ /** 启动参数 */
6
+ interface LaunchOptions {
7
+ /** 启动小程序的路径 */
8
+ path: string
9
+ /** 启动小程序的 query 参数 */
10
+ query: TaroGeneral.IAnyObject
11
+ /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
12
+ scene: number
13
+ /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
14
+ shareTicket: string
15
+ /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
16
+ referrerInfo: LaunchOptions.ReferrerInfo
17
+ /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
18
+ forwardMaterials?: LaunchOptions.ForwardMaterial[]
19
+ /** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型 */
20
+ chatType?: keyof LaunchOptions.ChatType
21
+ /** API 类别 */
22
+ apiCategory?: keyof LaunchOptions.ApiCategory
23
+ }
24
+
25
+ namespace LaunchOptions {
26
+ /** 来源信息 */
27
+ interface ReferrerInfo {
28
+ /** 来源小程序、公众号或 App 的 appId */
29
+ appId?: string
30
+ /** 来源小程序传过来的数据,scene=1037或1038时支持 */
31
+ extraData?: TaroGeneral.IAnyObject
32
+ }
33
+ /** ChatType 类型合法值 */
34
+ interface ForwardMaterial {
35
+ /** 文件的mimetype类型 */
36
+ type: string
37
+ /** 文件名 */
38
+ name: string
39
+ /** 文件路径(如果是webview则是url) */
40
+ path: string
41
+ /** 文件大小 */
42
+ size: number
43
+ }
44
+ /** ChatType 类型合法值 */
45
+ interface ChatType {
46
+ /** 微信联系人单聊 */
47
+ 1
48
+ /** 企业微信联系人单聊 */
49
+ 2
50
+ /** 普通微信群聊 */
51
+ 3
52
+ /** 企业微信互通群聊 */
53
+ 4
54
+ }
55
+ /** API 类别合法值 */
56
+ interface ApiCategory {
57
+ /** 默认类别 */
58
+ default
59
+ /** 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序 */
60
+ nativeFunctionalized
61
+ /** 仅浏览,朋友圈快照页等场景打开的小程序 */
62
+ browseOnly
63
+ /** 内嵌,通过打开半屏小程序能力打开的小程序 */
64
+ embedded
65
+ }
66
+ }
67
+ }
68
+
69
+ namespace getEnterOptionsSync {
70
+ /** 启动参数 */
71
+ interface EnterOptions {
72
+ /** 启动小程序的路径 */
73
+ path: string
74
+ /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
75
+ scene: number
76
+ /** 启动小程序的 query 参数 */
77
+ query: TaroGeneral.IAnyObject
78
+ /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
79
+ shareTicket: string
80
+ /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
81
+ referrerInfo: EnterOptions.ReferrerInfo
82
+ /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
83
+ forwardMaterials?: EnterOptions.ForwardMaterial[]
84
+ /** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型 */
85
+ chatType?: keyof EnterOptions.ChatType
86
+ /** API 类别 */
87
+ apiCategory?: keyof EnterOptions.ApiCategory
88
+ }
89
+
90
+ namespace EnterOptions {
91
+ /** 来源信息 */
92
+ interface ReferrerInfo {
93
+ /** 来源小程序、公众号或 App 的 appId */
94
+ appId?: string
95
+ /** 来源小程序传过来的数据,scene=1037或1038时支持 */
96
+ extraData?: TaroGeneral.IAnyObject
97
+ }
98
+ /** ChatType 类型合法值 */
99
+ interface ForwardMaterial {
100
+ /** 文件的mimetype类型 */
101
+ type: string
102
+ /** 文件名 */
103
+ name: string
104
+ /** 文件路径(如果是webview则是url) */
105
+ path: string
106
+ /** 文件大小 */
107
+ size: number
108
+ }
109
+ /** ChatType 类型合法值 */
110
+ interface ChatType {
111
+ /** 微信联系人单聊 */
112
+ 1
113
+ /** 企业微信联系人单聊 */
114
+ 2
115
+ /** 普通微信群聊 */
116
+ 3
117
+ /** 企业微信互通群聊 */
118
+ 4
119
+ }
120
+ /** API 类别合法值 */
121
+ interface ApiCategory {
122
+ /** 默认类别 */
123
+ default
124
+ /** 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序 */
125
+ nativeFunctionalized
126
+ /** 仅浏览,朋友圈快照页等场景打开的小程序 */
127
+ browseOnly
128
+ /** 内嵌,通过打开半屏小程序能力打开的小程序 */
129
+ embedded
130
+ }
131
+ }
132
+ }
133
+
4
134
  interface TaroStatic {
5
135
  /**
6
136
  * 获取小程序启动时的参数。与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onlaunchobject-object) 的回调参数一致。
7
137
  *
8
138
  * **注意**
9
139
  * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
10
- * @supported weapp
140
+ * @supported weapp, tt
11
141
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html
12
142
  */
13
- getLaunchOptionsSync(): TaroGeneral.LaunchOptionsApp
143
+ getLaunchOptionsSync(): getLaunchOptionsSync.LaunchOptions
144
+
145
+ /**
146
+ * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onLaunch-Object-object) 的回调参数一致;如果当前是热启动,则返回值与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onShow-Object-object) 一致。
147
+ *
148
+ * **注意**
149
+ * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
150
+ * @supported weapp
151
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getEnterOptionsSync.html
152
+ */
153
+ getEnterOptionsSync(): getEnterOptionsSync.EnterOptions
14
154
  }
15
155
  }