@tarojs/taro 3.4.1 → 3.4.2
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 +5 -5
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +46 -23
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +150 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +8 -8
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +61 -32
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +45 -16
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -25
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +125 -37
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +111 -107
- package/types/compile.d.ts +5 -0
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- 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
|
|
4
|
+
namespace openEmbeddedMiniProgram {
|
|
5
5
|
interface Option {
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
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
|
|
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
|
-
* @
|
|
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
|
-
|
|
93
|
+
openEmbeddedMiniProgram(option?: openEmbeddedMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
|
|
67
94
|
|
|
68
95
|
/** 打开另一个小程序
|
|
69
96
|
*
|
|
@@ -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
|
}
|
|
@@ -66,22 +66,45 @@ declare module '../../index' {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/** 一个可以监听下载进度变化事件,以及取消下载任务的对象
|
|
70
|
+
* @supported weapp, swan, alipay, h5, rn
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const downloadTask = Taro.downloadFile({
|
|
74
|
+
* url: 'http://example.com/audio/123', //仅为示例,并非真实的资源
|
|
75
|
+
* success (res) {
|
|
76
|
+
* Taro.playVoice({
|
|
77
|
+
* filePath: res.tempFilePath
|
|
78
|
+
* })
|
|
79
|
+
* }
|
|
80
|
+
* })
|
|
81
|
+
*
|
|
82
|
+
* downloadTask.onProgressUpdate((res) => {
|
|
83
|
+
* console.log('下载进度', res.progress)
|
|
84
|
+
* console.log('已经下载的数据长度', res.totalBytesWritten)
|
|
85
|
+
* console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite)
|
|
86
|
+
* })
|
|
87
|
+
*
|
|
88
|
+
* downloadTask.abort() // 取消下载任务
|
|
89
|
+
* ```
|
|
90
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html
|
|
91
|
+
*/
|
|
69
92
|
interface DownloadTask {
|
|
70
93
|
/** 中断下载任务
|
|
71
|
-
* @supported weapp
|
|
94
|
+
* @supported weapp, h5, rn
|
|
72
95
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html
|
|
73
96
|
*/
|
|
74
97
|
abort(): void
|
|
75
|
-
/**
|
|
76
|
-
* @supported weapp
|
|
77
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.
|
|
98
|
+
/** 监听下载进度变化事件
|
|
99
|
+
* @supported weapp, h5, rn
|
|
100
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html
|
|
78
101
|
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
callback: DownloadTask.
|
|
102
|
+
onProgressUpdate(
|
|
103
|
+
/** 下载进度变化事件的回调函数 */
|
|
104
|
+
callback: DownloadTask.OnProgressUpdateCallback,
|
|
82
105
|
): void
|
|
83
106
|
/** 取消监听下载进度变化事件
|
|
84
|
-
* @supported weapp
|
|
107
|
+
* @supported weapp, h5, rn
|
|
85
108
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html
|
|
86
109
|
*/
|
|
87
110
|
offProgressUpdate(
|
|
@@ -89,20 +112,20 @@ declare module '../../index' {
|
|
|
89
112
|
callback: DownloadTask.OffProgressUpdateCallback,
|
|
90
113
|
): void
|
|
91
114
|
/** 监听 HTTP Response Header 事件。会比请求完成事件更早
|
|
92
|
-
* @supported weapp
|
|
115
|
+
* @supported weapp, h5
|
|
93
116
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html
|
|
94
117
|
*/
|
|
95
118
|
onHeadersReceived(
|
|
96
119
|
/** HTTP Response Header 事件的回调函数 */
|
|
97
120
|
callback: DownloadTask.OnHeadersReceivedCallback,
|
|
98
121
|
): void
|
|
99
|
-
/**
|
|
100
|
-
* @supported weapp
|
|
101
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.
|
|
122
|
+
/** 取消监听 HTTP Response Header 事件
|
|
123
|
+
* @supported weapp, h5
|
|
124
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html
|
|
102
125
|
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
callback: DownloadTask.
|
|
126
|
+
offHeadersReceived(
|
|
127
|
+
/** HTTP Response Header 事件的回调函数 */
|
|
128
|
+
callback: DownloadTask.OffHeadersReceivedCallback,
|
|
106
129
|
): void
|
|
107
130
|
}
|
|
108
131
|
|
|
@@ -110,7 +133,7 @@ declare module '../../index' {
|
|
|
110
133
|
/** 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径,单次下载允许的最大文件为 50MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
|
|
111
134
|
*
|
|
112
135
|
* 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
|
|
113
|
-
* @supported weapp, h5, alipay, swan
|
|
136
|
+
* @supported weapp, h5, alipay, swan, rn
|
|
114
137
|
* @example
|
|
115
138
|
* ```tsx
|
|
116
139
|
* Taro.downloadFile({
|