@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
@@ -0,0 +1,290 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace updateVoIPChatMuteConfig {
5
+ interface Option {
6
+ /** 静音设置 */
7
+ muteConfig: MuteConfig
8
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用失败的回调函数 */
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用成功的回调函数 */
13
+ success?: (res: TaroGeneral.CallbackResult) => void
14
+ }
15
+ /** 静音设置 */
16
+ interface MuteConfig {
17
+ /** 是否静音麦克风 */
18
+ muteMicrophone?: boolean
19
+ /** 是否静音耳机 */
20
+ muteEarphone?: boolean
21
+ }
22
+ }
23
+
24
+ namespace subscribeVoIPVideoMembers {
25
+ interface Option {
26
+ /** 订阅的成员列表 */
27
+ openIdList: string[]
28
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
29
+ complete?: (res: TaroGeneral.CallbackResult) => void
30
+ /** 接口调用失败的回调函数 */
31
+ fail?: (res: TaroGeneral.CallbackResult) => void
32
+ /** 接口调用成功的回调函数 */
33
+ success?: (res: TaroGeneral.CallbackResult) => void
34
+ }
35
+ }
36
+
37
+ namespace setEnable1v1Chat {
38
+ interface Option {
39
+ /** 是否开启 */
40
+ enable: boolean
41
+ /** 窗口背景色
42
+ * @default 0
43
+ */
44
+ backgroundType?: keyof ColorType
45
+ /** 小窗样式
46
+ * @default 1
47
+ */
48
+ minWindowType?: keyof ColorType
49
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
50
+ complete?: (res: TaroGeneral.CallbackResult) => void
51
+ /** 接口调用失败的回调函数 */
52
+ fail?: (res: TaroGeneral.CallbackResult) => void
53
+ /** 接口调用成功的回调函数 */
54
+ success?: (res: TaroGeneral.CallbackResult) => void
55
+ }
56
+ /** 音频通话背景以及小窗模式背景 */
57
+ interface ColorType {
58
+ /** #262930 */
59
+ 0
60
+ /** #FA5151 */
61
+ 1
62
+ /** #FA9D3B */
63
+ 2
64
+ /** #3D7257 */
65
+ 3
66
+ /** #1485EE */
67
+ 4
68
+ /** #6467F0 */
69
+ 5
70
+ }
71
+ }
72
+
73
+ namespace onVoIPVideoMembersChanged {
74
+ interface Result extends TaroGeneral.CallbackResult {
75
+ /** 开启视频的成员名单 */
76
+ openIdList: string[]
77
+ /** 错误码 */
78
+ errCode: number
79
+ /** 调用结果 */
80
+ errMsg: string
81
+ }
82
+ /** 实时语音通话成员视频状态变化事件的回调函数 */
83
+ type Callback = (res: Result) => void
84
+ }
85
+
86
+ namespace onVoIPChatStateChanged {
87
+ interface Result extends TaroGeneral.CallbackResult {
88
+ /** 事件码 */
89
+ code: number
90
+ /** 附加信息 */
91
+ data: Record<any, any>
92
+ /** 错误码 */
93
+ errCode: number
94
+ /** 调用结果 */
95
+ errMsg: string
96
+ }
97
+ /** 房间状态变化事件的回调函数 */
98
+ type Callback = (res: Result) => void
99
+ }
100
+
101
+ namespace onVoIPChatSpeakersChanged {
102
+ interface Result extends TaroGeneral.CallbackResult {
103
+ /** 还在实时语音通话中的成员 openId 名单 */
104
+ openIdList: string[]
105
+ /** 错误码 */
106
+ errCode: number
107
+ /** 调用结果 */
108
+ errMsg: string
109
+ }
110
+ /** 房间状态变化事件的回调函数 */
111
+ type Callback = (res: Result) => void
112
+ }
113
+
114
+ namespace onVoIPChatMembersChanged {
115
+ interface Result extends TaroGeneral.CallbackResult {
116
+ /** 还在实时语音通话中的成员 openId 名单 */
117
+ openIdList: string[]
118
+ /** 错误码 */
119
+ errCode: number
120
+ /** 调用结果 */
121
+ errMsg: string
122
+ }
123
+ /** 房间状态变化事件的回调函数 */
124
+ type Callback = (res: Result) => void
125
+ }
126
+
127
+ namespace onVoIPChatInterrupted {
128
+ interface Result extends TaroGeneral.CallbackResult {
129
+ /** 还在实时语音通话中的成员 openId 名单 */
130
+ openIdList: string[]
131
+ /** 错误码 */
132
+ errCode: number
133
+ /** 调用结果 */
134
+ errMsg: string
135
+ }
136
+ /** 房间状态变化事件的回调函数 */
137
+ type Callback = (res: Result) => void
138
+ }
139
+
140
+ namespace joinVoIPChat {
141
+ type Promised = FailCallbackResult | SuccessCallbackResult
142
+ interface Option {
143
+ /** 房间类型
144
+ * @default "voice"
145
+ */
146
+ roomType?: RoomType
147
+ /** 签名,用于验证小游戏的身份 */
148
+ signature: string
149
+ /** 验证所需的随机字符串 */
150
+ nonceStr: string
151
+ /** 验证所需的时间戳 */
152
+ timeStamp: number
153
+ /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */
154
+ groupId: string
155
+ /** 静音设置 */
156
+ muteConfig?: MuteConfig
157
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
158
+ complete?: (res: TaroGeneral.CallbackResult) => void
159
+ /** 接口调用失败的回调函数 */
160
+ fail?: (res: TaroGeneral.CallbackResult) => void
161
+ /** 接口调用成功的回调函数 */
162
+ success?: (res: TaroGeneral.CallbackResult) => void
163
+ }
164
+ /** 房间类型 */
165
+ interface RoomType {
166
+ /** 音频房间,用于语音通话 */
167
+ voice
168
+ /** 视频房间,结合 [voip-room](/docs/components/media/voip-room) 组件可显示成员画面 */
169
+ video
170
+ }
171
+ /** 静音设置 */
172
+ interface MuteConfig {
173
+ /** 是否静音麦克风 */
174
+ muteMicrophone?: boolean
175
+ /** 是否静音耳机 */
176
+ muteEarphone?: boolean
177
+ }
178
+ interface FailCallbackResult extends TaroGeneral.CallbackResult {
179
+ /** 错误信息 */
180
+ errMsg: string
181
+ /** 错误码 */
182
+ errCode: keyof VoipErrCode
183
+ }
184
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
185
+ /** 还在实时语音通话中的成员 openId 名单 */
186
+ openIdList: string[]
187
+ /** 错误码 */
188
+ errCode: number
189
+ /** 调用结果 */
190
+ errMsg: string
191
+ }
192
+ /** Voip 错误码 */
193
+ interface VoipErrCode {
194
+ /** 当前已在房间内 */
195
+ [-1]
196
+ /** 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 */
197
+ [-2]
198
+ /** 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 */
199
+ [-3]
200
+ /** 系统错误 */
201
+ [-1000]
202
+ }
203
+ }
204
+
205
+ namespace exitVoIPChat {
206
+ interface Option {
207
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
208
+ complete?: (res: TaroGeneral.CallbackResult) => void
209
+ /** 接口调用失败的回调函数 */
210
+ fail?: (res: TaroGeneral.CallbackResult) => void
211
+ /** 接口调用成功的回调函数 */
212
+ success?: (res: TaroGeneral.CallbackResult) => void
213
+ }
214
+ }
215
+
216
+ interface TaroStatic {
217
+ /** 更新实时语音静音设置
218
+ * @supported weapp
219
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.updateVoIPChatMuteConfig.html
220
+ */
221
+ updateVoIPChatMuteConfig(option: updateVoIPChatMuteConfig.Option): Promise<TaroGeneral.CallbackResult>
222
+ /** 订阅视频画面成员
223
+ * @supported weapp
224
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html
225
+ */
226
+ subscribeVoIPVideoMembers(option: subscribeVoIPVideoMembers.Option): Promise<TaroGeneral.CallbackResult>
227
+ /** 开启双人通话
228
+ * @supported weapp
229
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html
230
+ */
231
+ setEnable1v1Chat(option: subscribeVoIPVideoMembers.Option): Promise<TaroGeneral.CallbackResult>
232
+ /** 监听实时语音通话成员视频状态变化事件
233
+ * @supported weapp
234
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html
235
+ */
236
+ onVoIPVideoMembersChanged(callback: onVoIPVideoMembersChanged.Callback): void
237
+ /** 监听房间状态变化事件
238
+ * @supported weapp
239
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatStateChanged.html
240
+ */
241
+ onVoIPChatStateChanged(callback: onVoIPChatStateChanged.Callback): void
242
+ /** 监听实时语音通话成员通话状态变化事件
243
+ * @supported weapp
244
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html
245
+ */
246
+ onVoIPChatSpeakersChanged(callback: onVoIPChatSpeakersChanged.Callback): void
247
+ /** 监听实时语音通话成员在线状态变化事件
248
+ * @supported weapp
249
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html
250
+ */
251
+ onVoIPChatMembersChanged(callback: onVoIPChatMembersChanged.Callback): void
252
+ /** 监听被动断开实时语音通话事件
253
+ * @supported weapp
254
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html
255
+ */
256
+ onVoIPChatInterrupted(callback: onVoIPChatInterrupted.Callback): void
257
+ /** 取消监听实时语音通话成员视频状态变化事件
258
+ * @supported weapp
259
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html
260
+ */
261
+ offVoIPVideoMembersChanged(callback: onVoIPVideoMembersChanged.Callback): void
262
+ /** 取消监听房间状态变化事件
263
+ * @supported weapp
264
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html
265
+ */
266
+ offVoIPChatStateChanged(callback: onVoIPChatStateChanged.Callback): void
267
+ /** 取消监听实时语音通话成员在线状态变化事件
268
+ * @supported weapp
269
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html
270
+ */
271
+ offVoIPChatMembersChanged(callback: onVoIPChatMembersChanged.Callback): void
272
+ /** 取消监听被动断开实时语音通话事件
273
+ * @supported weapp
274
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html
275
+ */
276
+ offVoIPChatInterrupted(callback: onVoIPChatInterrupted.Callback): void
277
+ /** 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)
278
+ *
279
+ * 调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。
280
+ * @supported weapp
281
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html
282
+ */
283
+ joinVoIPChat(option: joinVoIPChat.Option): Promise<joinVoIPChat.Promised>
284
+ /** 退出(销毁)实时语音通话
285
+ * @supported weapp
286
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html
287
+ */
288
+ exitVoIPChat(option: exitVoIPChat.Option): Promise<TaroGeneral.CallbackResult>
289
+ }
290
+ }
@@ -1,14 +1,33 @@
1
1
  import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
- namespace exitMiniProgram {
4
+ namespace openEmbeddedMiniProgram {
5
5
  interface Option {
6
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: TaroGeneral.CallbackResult) => void
8
- /** 接口调用失败的回调函数 */
9
- fail?: (res: TaroGeneral.CallbackResult) => void
6
+ /** 要打开的小程序 appId */
7
+ appId: string
8
+ /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [Taro.onShow](#) 回调函数、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
9
+ path?: string
10
+ /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [Taro.onShow](#)、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到这份数据数据。 */
11
+ extraData?: TaroGeneral.IAnyObject
12
+ /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。*/
13
+ envVersion?: keyof EnvVersion
14
+ /** 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。 */
15
+ shortLink?: string
10
16
  /** 接口调用成功的回调函数 */
11
17
  success?: (res: TaroGeneral.CallbackResult) => void
18
+ /** 接口调用失败的回调函数 */
19
+ fail?: (res: TaroGeneral.CallbackResult) => void
20
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
21
+ complete?: (res: TaroGeneral.CallbackResult) => void
22
+ }
23
+
24
+ interface EnvVersion {
25
+ /** 开发版 */
26
+ develop
27
+ /** 体验版 */
28
+ trial
29
+ /** 正式版 */
30
+ release
12
31
  }
13
32
  }
14
33
 
@@ -16,21 +35,23 @@ declare module '../../index' {
16
35
  interface Option {
17
36
  /** 要打开的小程序 appId */
18
37
  appId: string
19
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
20
- complete?: (res: TaroGeneral.CallbackResult) => void
21
- /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。*/
22
- envVersion?: keyof envVersion
23
- /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
24
- extraData?: TaroGeneral.IAnyObject
25
- /** 接口调用失败的回调函数 */
26
- fail?: (res: TaroGeneral.CallbackResult) => void
27
- /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
38
+ /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [Taro.onShow](#) 回调函数、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
28
39
  path?: string
40
+ /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [Taro.onShow](#)、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到这份数据数据。 */
41
+ extraData?: TaroGeneral.IAnyObject
42
+ /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。*/
43
+ envVersion?: keyof EnvVersion
44
+ /** 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。 */
45
+ shortLink?: string
29
46
  /** 接口调用成功的回调函数 */
30
47
  success?: (res: TaroGeneral.CallbackResult) => void
48
+ /** 接口调用失败的回调函数 */
49
+ fail?: (res: TaroGeneral.CallbackResult) => void
50
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
51
+ complete?: (res: TaroGeneral.CallbackResult) => void
31
52
  }
32
53
 
33
- interface envVersion {
54
+ interface EnvVersion {
34
55
  /** 开发版 */
35
56
  develop
36
57
  /** 体验版 */
@@ -42,28 +63,34 @@ declare module '../../index' {
42
63
 
43
64
  namespace navigateBackMiniProgram {
44
65
  interface Option {
45
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
46
- complete?: (res: TaroGeneral.CallbackResult) => void
47
66
  /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */
48
67
  extraData?: TaroGeneral.IAnyObject
68
+ /** 接口调用成功的回调函数 */
69
+ success?: (res: TaroGeneral.CallbackResult) => void
49
70
  /** 接口调用失败的回调函数 */
50
71
  fail?: (res: TaroGeneral.CallbackResult) => void
72
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
73
+ complete?: (res: TaroGeneral.CallbackResult) => void
74
+ }
75
+ }
76
+
77
+ namespace exitMiniProgram {
78
+ interface Option {
51
79
  /** 接口调用成功的回调函数 */
52
80
  success?: (res: TaroGeneral.CallbackResult) => void
81
+ /** 接口调用失败的回调函数 */
82
+ fail?: (res: TaroGeneral.CallbackResult) => void
83
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
84
+ complete?: (res: TaroGeneral.CallbackResult) => void
53
85
  }
54
86
  }
55
87
 
56
88
  interface TaroStatic {
57
- /** 退出当前小程序。必须有点击行为才能调用成功。
89
+ /** 打开半屏小程序。接入指引请参考 [半屏小程序能力](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/openEmbeddedMiniProgram.html)。
58
90
  * @supported weapp
59
- * @example
60
- * ```tsx
61
- * Taro.exitMiniProgram()
62
- * ···
63
- *
64
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html
91
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openEmbeddedMiniProgram.html
65
92
  */
66
- exitMiniProgram(option?: exitMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
93
+ openEmbeddedMiniProgram(option?: openEmbeddedMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
67
94
 
68
95
  /** 打开另一个小程序
69
96
  *
@@ -78,7 +105,7 @@ declare module '../../index' {
78
105
  * **关于调试**
79
106
  * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
80
107
  * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
81
- * @supported weapp
108
+ * @supported weapp, tt
82
109
  * @example
83
110
  * ```tsx
84
111
  * Taro.navigateToMiniProgram({
@@ -100,7 +127,7 @@ declare module '../../index' {
100
127
  /** 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
101
128
  *
102
129
  * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
103
- * @supported weapp
130
+ * @supported weapp, tt
104
131
  * @example
105
132
  * ```tsx
106
133
  * Taro.navigateBackMiniProgram({
@@ -115,5 +142,16 @@ declare module '../../index' {
115
142
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html
116
143
  */
117
144
  navigateBackMiniProgram(option: navigateBackMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
145
+
146
+ /** 退出当前小程序。必须有点击行为才能调用成功。
147
+ * @supported weapp
148
+ * @example
149
+ * ```tsx
150
+ * Taro.exitMiniProgram()
151
+ * ···
152
+ *
153
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html
154
+ */
155
+ exitMiniProgram(option?: exitMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
118
156
  }
119
157
  }
@@ -26,6 +26,26 @@ declare module '../../index' {
26
26
  tempFilePath: string
27
27
  /** 调用结果 */
28
28
  errMsg: string
29
+ /**
30
+ * 开发者服务器返回的 HTTP Response Header
31
+ * @supported weapp
32
+ * @weapp 非官方文档标注属性
33
+ */
34
+ header?: TaroGeneral.IAnyObject
35
+ /**
36
+ * 数据长度,单位 Byte
37
+ * @supported weapp
38
+ * @weapp 非官方文档标注属性
39
+ */
40
+ dataLength?: number
41
+ /**
42
+ * cookies
43
+ * @supported weapp
44
+ * @weapp 非官方文档标注属性
45
+ */
46
+ cookies?: string[]
47
+ /** 网络请求过程中一些调试信息 */
48
+ profile?: TaroGeneral.IAnyObject
29
49
  }
30
50
  }
31
51
 
@@ -59,29 +79,51 @@ declare module '../../index' {
59
79
  totalBytesWritten: number
60
80
  }
61
81
 
62
- type DownloadTaskPromise = Promise<DownloadTask> & {
82
+ type DownloadTaskPromise = Promise<downloadFile.FileSuccessCallbackResult> & DownloadTask & {
63
83
  headersReceive: DownloadTask['onHeadersReceived'],
64
- progress: DownloadTask['onProgressUpdate'],
65
- abort: DownloadTask['abort']
84
+ progress: DownloadTask['onProgressUpdate']
66
85
  }
67
86
  }
68
87
 
88
+ /** 一个可以监听下载进度变化事件,以及取消下载任务的对象
89
+ * @supported weapp, swan, alipay, h5, rn, tt
90
+ * @example
91
+ * ```tsx
92
+ * const downloadTask = Taro.downloadFile({
93
+ * url: 'http://example.com/audio/123', //仅为示例,并非真实的资源
94
+ * success (res) {
95
+ * Taro.playVoice({
96
+ * filePath: res.tempFilePath
97
+ * })
98
+ * }
99
+ * })
100
+ *
101
+ * downloadTask.onProgressUpdate((res) => {
102
+ * console.log('下载进度', res.progress)
103
+ * console.log('已经下载的数据长度', res.totalBytesWritten)
104
+ * console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite)
105
+ * })
106
+ *
107
+ * downloadTask.abort() // 取消下载任务
108
+ * ```
109
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html
110
+ */
69
111
  interface DownloadTask {
70
112
  /** 中断下载任务
71
- * @supported weapp
113
+ * @supported weapp, h5, tt
72
114
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html
73
115
  */
74
116
  abort(): void
75
- /** 取消监听 HTTP Response Header 事件
76
- * @supported weapp
77
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html
117
+ /** 监听下载进度变化事件
118
+ * @supported weapp, h5, tt
119
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html
78
120
  */
79
- offHeadersReceived(
80
- /** HTTP Response Header 事件的回调函数 */
81
- callback: DownloadTask.OffHeadersReceivedCallback,
121
+ onProgressUpdate(
122
+ /** 下载进度变化事件的回调函数 */
123
+ callback: DownloadTask.OnProgressUpdateCallback,
82
124
  ): void
83
125
  /** 取消监听下载进度变化事件
84
- * @supported weapp
126
+ * @supported weapp, h5, tt
85
127
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html
86
128
  */
87
129
  offProgressUpdate(
@@ -89,20 +131,20 @@ declare module '../../index' {
89
131
  callback: DownloadTask.OffProgressUpdateCallback,
90
132
  ): void
91
133
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
92
- * @supported weapp
134
+ * @supported weapp, h5
93
135
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html
94
136
  */
95
137
  onHeadersReceived(
96
138
  /** HTTP Response Header 事件的回调函数 */
97
139
  callback: DownloadTask.OnHeadersReceivedCallback,
98
140
  ): void
99
- /** 监听下载进度变化事件
100
- * @supported weapp
101
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html
141
+ /** 取消监听 HTTP Response Header 事件
142
+ * @supported weapp, h5
143
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html
102
144
  */
103
- onProgressUpdate(
104
- /** 下载进度变化事件的回调函数 */
105
- callback: DownloadTask.OnProgressUpdateCallback,
145
+ offHeadersReceived(
146
+ /** HTTP Response Header 事件的回调函数 */
147
+ callback: DownloadTask.OffHeadersReceivedCallback,
106
148
  ): void
107
149
  }
108
150
 
@@ -110,7 +152,7 @@ declare module '../../index' {
110
152
  /** 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径,单次下载允许的最大文件为 50MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
111
153
  *
112
154
  * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
113
- * @supported weapp, h5, alipay, swan
155
+ * @supported weapp, h5, alipay, swan, rn, tt
114
156
  * @example
115
157
  * ```tsx
116
158
  * Taro.downloadFile({