@tarojs/taro 3.8.0-canary.0 → 4.0.0-alpha.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.
Files changed (101) hide show
  1. package/html.css +9 -0
  2. package/package.json +16 -4
  3. package/types/api/ad/index.d.ts +6 -18
  4. package/types/api/ai/inference.d.ts +4 -8
  5. package/types/api/ai/visionkit.d.ts +625 -54
  6. package/types/api/base/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +1 -1
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +6 -6
  11. package/types/api/base/weapp/app-event.d.ts +10 -10
  12. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  13. package/types/api/canvas/index.d.ts +389 -72
  14. package/types/api/data-analysis/index.d.ts +51 -1
  15. package/types/api/device/accelerometer.d.ts +8 -6
  16. package/types/api/device/accessibility.d.ts +1 -1
  17. package/types/api/device/battery.d.ts +3 -3
  18. package/types/api/device/bluetooth-ble.d.ts +40 -17
  19. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  20. package/types/api/device/bluetooth.d.ts +37 -13
  21. package/types/api/device/calendar.d.ts +11 -1
  22. package/types/api/device/clipboard.d.ts +17 -17
  23. package/types/api/device/compass.d.ts +5 -5
  24. package/types/api/device/gyroscope.d.ts +4 -4
  25. package/types/api/device/iBeacon.d.ts +10 -8
  26. package/types/api/device/keyboard.d.ts +7 -5
  27. package/types/api/device/memory.d.ts +3 -4
  28. package/types/api/device/motion.d.ts +8 -6
  29. package/types/api/device/network.d.ts +12 -6
  30. package/types/api/device/nfc.d.ts +13 -13
  31. package/types/api/device/phone.d.ts +1 -1
  32. package/types/api/device/scan.d.ts +5 -3
  33. package/types/api/device/screen.d.ts +28 -12
  34. package/types/api/device/sms.d.ts +1 -1
  35. package/types/api/device/vibrate.d.ts +5 -5
  36. package/types/api/device/wifi.d.ts +25 -13
  37. package/types/api/files/index.d.ts +73 -43
  38. package/types/api/framework/index.d.ts +2 -2
  39. package/types/api/location/index.d.ts +167 -19
  40. package/types/api/media/audio.d.ts +71 -42
  41. package/types/api/media/background-audio.d.ts +1 -1
  42. package/types/api/media/camera.d.ts +6 -3
  43. package/types/api/media/image.d.ts +5 -5
  44. package/types/api/media/video.d.ts +11 -11
  45. package/types/api/navigate/index.d.ts +3 -1
  46. package/types/api/network/download.d.ts +7 -15
  47. package/types/api/network/request.d.ts +7 -7
  48. package/types/api/network/upload.d.ts +9 -17
  49. package/types/api/network/websocket.d.ts +8 -8
  50. package/types/api/open-api/account.d.ts +1 -1
  51. package/types/api/open-api/address.d.ts +13 -5
  52. package/types/api/open-api/authorize.d.ts +1 -1
  53. package/types/api/open-api/channels.d.ts +16 -0
  54. package/types/api/open-api/device-voip.d.ts +42 -2
  55. package/types/api/open-api/invoice.d.ts +1 -1
  56. package/types/api/open-api/login.d.ts +16 -3
  57. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  58. package/types/api/open-api/privacy.d.ts +107 -0
  59. package/types/api/open-api/settings.d.ts +3 -2
  60. package/types/api/open-api/sticker.d.ts +83 -0
  61. package/types/api/open-api/subscribe-message.d.ts +148 -6
  62. package/types/api/open-api/user-info.d.ts +6 -1
  63. package/types/api/qq/index.d.ts +306 -1
  64. package/types/api/route/index.d.ts +8 -5
  65. package/types/api/skyline/index.d.ts +59 -0
  66. package/types/api/storage/background-fetch.d.ts +63 -11
  67. package/types/api/storage/cache-manager.d.ts +61 -10
  68. package/types/api/storage/index.d.ts +125 -10
  69. package/types/api/swan/bookshelf.d.ts +307 -0
  70. package/types/api/swan/download-package.d.ts +80 -0
  71. package/types/api/swan/index.d.ts +151 -0
  72. package/types/api/swan/pay.d.ts +139 -0
  73. package/types/api/taro.extend.d.ts +15 -6
  74. package/types/api/taro.hooks.d.ts +9 -9
  75. package/types/api/ui/animation.d.ts +32 -32
  76. package/types/api/ui/custom-component.d.ts +1 -1
  77. package/types/api/ui/fonts.d.ts +4 -3
  78. package/types/api/ui/interaction.d.ts +6 -6
  79. package/types/api/ui/menu.d.ts +1 -1
  80. package/types/api/ui/navigation-bar.d.ts +5 -5
  81. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  82. package/types/api/ui/scroll.d.ts +1 -1
  83. package/types/api/ui/tab-bar.d.ts +8 -8
  84. package/types/api/ui/window.d.ts +2 -2
  85. package/types/api/wxml/index.d.ts +19 -19
  86. package/types/compile/compiler.d.ts +9 -4
  87. package/types/compile/config/h5.d.ts +23 -10
  88. package/types/compile/config/harmony.d.ts +82 -0
  89. package/types/compile/config/index.d.ts +1 -0
  90. package/types/compile/config/mini.d.ts +58 -30
  91. package/types/compile/config/plugin.d.ts +34 -0
  92. package/types/compile/config/project.d.ts +26 -13
  93. package/types/compile/config/util.d.ts +22 -8
  94. package/types/compile/viteCompilerContext.d.ts +155 -0
  95. package/types/global.d.ts +3 -1
  96. package/types/index.d.ts +92 -44
  97. package/types/taro.api.d.ts +24 -13
  98. package/types/taro.component.d.ts +2 -1
  99. package/types/taro.config.d.ts +47 -6
  100. package/types/taro.lifecycle.d.ts +3 -0
  101. package/types/taro.runtime.d.ts +9 -0
@@ -89,7 +89,7 @@ declare module '../../index' {
89
89
  /** VideoContext 实例,可通过 [Taro.createVideoContext](./createVideoContext) 获取。
90
90
  *
91
91
  * VideoContext 通过 id 跟一个 video 组件绑定,操作对应的 video 组件。
92
- * @supported weapp, h5, rn
92
+ * @supported weapp, h5, rn, harmony_hybrid
93
93
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html
94
94
  */
95
95
  interface VideoContext {
@@ -99,7 +99,7 @@ declare module '../../index' {
99
99
  */
100
100
  exitBackgroundPlayback(): void
101
101
  /** 退出全屏
102
- * @supported weapp, h5, rn
102
+ * @supported weapp, h5, rn, harmony_hybrid
103
103
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html
104
104
  */
105
105
  exitFullScreen(): void
@@ -114,17 +114,17 @@ declare module '../../index' {
114
114
  */
115
115
  hideStatusBar(): void
116
116
  /** 暂停视频
117
- * @supported weapp, h5, rn
117
+ * @supported weapp, h5, rn, harmony_hybrid
118
118
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html
119
119
  */
120
120
  pause(): void
121
121
  /** 播放视频
122
- * @supported weapp, h5, rn
122
+ * @supported weapp, h5, rn, harmony_hybrid
123
123
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html
124
124
  */
125
125
  play(): void
126
126
  /** 设置倍速播放
127
- * @supported weapp, h5, rn
127
+ * @supported weapp, h5, rn, harmony_hybrid
128
128
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html
129
129
  */
130
130
  playbackRate(
@@ -137,12 +137,12 @@ declare module '../../index' {
137
137
  */
138
138
  requestBackgroundPlayback(): void
139
139
  /** 进入全屏
140
- * @supported weapp, h5, rn
140
+ * @supported weapp, h5, rn, harmony_hybrid
141
141
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html
142
142
  */
143
143
  requestFullScreen(option: VideoContext.RequestFullScreenOption): void
144
144
  /** 跳转到指定位置
145
- * @supported weapp, h5, rn
145
+ * @supported weapp, h5, rn, harmony_hybrid
146
146
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html
147
147
  */
148
148
  seek(
@@ -163,7 +163,7 @@ declare module '../../index' {
163
163
  */
164
164
  showStatusBar(): void
165
165
  /** 停止视频
166
- * @supported weapp, h5, rn
166
+ * @supported weapp, h5, rn, harmony_hybrid
167
167
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html
168
168
  */
169
169
  stop(): void
@@ -414,7 +414,7 @@ declare module '../../index' {
414
414
  openVideoEditor(option: openVideoEditor.Option): Promise<openVideoEditor.SuccessCallbackResult>
415
415
 
416
416
  /** 获取视频详细信息
417
- * @supported weapp
417
+ * @supported weapp, harmony_hybrid
418
418
  * @example
419
419
  * ```tsx
420
420
  * Taro.downloadFile({
@@ -442,7 +442,7 @@ declare module '../../index' {
442
442
  getVideoInfo(option: getVideoInfo.Option): Promise<getVideoInfo.SuccessCallbackResult>
443
443
 
444
444
  /** 创建 video 上下文 VideoContext 对象。
445
- * @supported weapp, h5, rn
445
+ * @supported weapp, h5, rn, harmony_hybrid
446
446
  * @example
447
447
  * ```tsx
448
448
  * videoContext = Taro.createVideoContext('myVideo')
@@ -505,7 +505,7 @@ declare module '../../index' {
505
505
  chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
506
506
 
507
507
  /** 拍摄或从手机相册中选择图片或视频。
508
- * @supported weapp, h5
508
+ * @supported weapp, h5, harmony_hybrid
509
509
  * @example
510
510
  * ```tsx
511
511
  * Taro.chooseMedia({
@@ -17,6 +17,8 @@ declare module '../../index' {
17
17
  verify?: keyof Verify
18
18
  /** 不 reLaunch 目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query、apiCategory与上次启动相同。默认值为 false 。 */
19
19
  noRelaunchIfPathUnchanged?: boolean
20
+ /** 打开的小程序是否支持全屏 */
21
+ allowFullScreen?: boolean
20
22
  /** 接口调用成功的回调函数 */
21
23
  success?: (res: TaroGeneral.CallbackResult) => void
22
24
  /** 接口调用失败的回调函数 */
@@ -239,7 +241,7 @@ declare module '../../index' {
239
241
  * **关于调试**
240
242
  * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
241
243
  * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
242
- * @supported weapp, tt
244
+ * @supported weapp, tt, harmony_hybrid
243
245
  * @example
244
246
  * ```tsx
245
247
  * Taro.navigateToMiniProgram({
@@ -57,14 +57,6 @@ declare module '../../index' {
57
57
  }
58
58
 
59
59
  namespace DownloadTask {
60
- /** HTTP Response Header 事件的回调函数 */
61
- type OffHeadersReceivedCallback = (
62
- res: TaroGeneral.CallbackResult,
63
- ) => void
64
- /** 下载进度变化事件的回调函数 */
65
- type OffProgressUpdateCallback = (
66
- res: TaroGeneral.CallbackResult,
67
- ) => void
68
60
  /** HTTP Response Header 事件的回调函数 */
69
61
  type OnHeadersReceivedCallback = (
70
62
  result: OnHeadersReceivedCallbackResult,
@@ -93,7 +85,7 @@ declare module '../../index' {
93
85
  }
94
86
 
95
87
  /** 一个可以监听下载进度变化事件,以及取消下载任务的对象
96
- * @supported weapp, swan, alipay, h5, rn, tt
88
+ * @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
97
89
  * @example
98
90
  * ```tsx
99
91
  * const downloadTask = Taro.downloadFile({
@@ -117,12 +109,12 @@ declare module '../../index' {
117
109
  */
118
110
  interface DownloadTask {
119
111
  /** 中断下载任务
120
- * @supported weapp, h5, tt
112
+ * @supported weapp, h5, tt, harmony_hybrid
121
113
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html
122
114
  */
123
115
  abort(): void
124
116
  /** 监听下载进度变化事件
125
- * @supported weapp, h5, tt
117
+ * @supported weapp, h5, tt, harmony_hybrid
126
118
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html
127
119
  */
128
120
  onProgressUpdate(
@@ -130,12 +122,12 @@ declare module '../../index' {
130
122
  callback: DownloadTask.OnProgressUpdateCallback,
131
123
  ): void
132
124
  /** 取消监听下载进度变化事件
133
- * @supported weapp, h5, tt
125
+ * @supported weapp, h5, tt, harmony_hybrid
134
126
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html
135
127
  */
136
128
  offProgressUpdate(
137
129
  /** 下载进度变化事件的回调函数 */
138
- callback: DownloadTask.OffProgressUpdateCallback,
130
+ callback: DownloadTask.OnProgressUpdateCallback,
139
131
  ): void
140
132
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
141
133
  * @supported weapp, h5
@@ -151,7 +143,7 @@ declare module '../../index' {
151
143
  */
152
144
  offHeadersReceived(
153
145
  /** HTTP Response Header 事件的回调函数 */
154
- callback: DownloadTask.OffHeadersReceivedCallback,
146
+ callback: DownloadTask.OnHeadersReceivedCallback,
155
147
  ): void
156
148
  }
157
149
 
@@ -159,7 +151,7 @@ declare module '../../index' {
159
151
  /** 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径,单次下载允许的最大文件为 50MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
160
152
  *
161
153
  * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
162
- * @supported weapp, h5, alipay, swan, rn, tt
154
+ * @supported weapp, h5, alipay, swan, rn, tt, harmony_hybrid
163
155
  * @example
164
156
  * ```tsx
165
157
  * Taro.downloadFile({
@@ -13,8 +13,8 @@ declare module '../../index' {
13
13
  */
14
14
  header?: TaroGeneral.IAnyObject
15
15
  /** 超时时间,单位为毫秒
16
- * @default 2000
17
- * @supported weapp, h5, tt, alipay
16
+ * @default 60000
17
+ * @supported weapp, h5, tt, alipay, rn
18
18
  */
19
19
  timeout?: number
20
20
  /** HTTP 请求方法
@@ -262,7 +262,7 @@ declare module '../../index' {
262
262
  }
263
263
 
264
264
  /** 网络请求任务对象
265
- * @supported weapp, h5, rn, alipay, swan, tt, qq
265
+ * @supported weapp, h5, rn, alipay, swan, tt, qq, harmony_hybrid
266
266
  * @example
267
267
  * 回调函数(Callback)用法:
268
268
  *
@@ -316,12 +316,12 @@ declare module '../../index' {
316
316
  */
317
317
  interface RequestTask<T> extends Promise<request.SuccessCallbackResult<T>> {
318
318
  /** 中断请求任务
319
- * @supported weapp, tt
319
+ * @supported weapp, tt, harmony_hybrid
320
320
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html
321
321
  */
322
322
  abort(): void
323
323
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
324
- * @supported weapp
324
+ * @supported weapp, harmony_hybrid
325
325
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html
326
326
  */
327
327
  onHeadersReceived(
@@ -329,7 +329,7 @@ declare module '../../index' {
329
329
  callback: RequestTask.onHeadersReceived.Callback
330
330
  ): void
331
331
  /** 取消监听 HTTP Response Header 事件
332
- * @supported weapp
332
+ * @supported weapp, harmony_hybrid
333
333
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html
334
334
  */
335
335
  offHeadersReceived(
@@ -400,7 +400,7 @@ declare module '../../index' {
400
400
  * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
401
401
  * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
402
402
  * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
403
- * @supported weapp, h5, rn, alipay, swan, tt, qq
403
+ * @supported weapp, h5, rn, alipay, swan, tt, qq, harmony, harmony_hybrid
404
404
  * @example
405
405
  * ```tsx
406
406
  * Taro.request({
@@ -56,14 +56,6 @@ declare module '../../index' {
56
56
  }
57
57
 
58
58
  namespace UploadTask {
59
- /** HTTP Response Header 事件的回调函数 */
60
- type OffHeadersReceivedCallback = (
61
- res: TaroGeneral.CallbackResult,
62
- ) => void
63
- /** 上传进度变化事件的回调函数 */
64
- type OffProgressUpdateCallback = (
65
- res: TaroGeneral.CallbackResult,
66
- ) => void
67
59
  /** HTTP Response Header 事件的回调函数 */
68
60
  type OnHeadersReceivedCallback = (
69
61
  result: OnHeadersReceivedCallbackResult,
@@ -92,7 +84,7 @@ declare module '../../index' {
92
84
  }
93
85
 
94
86
  /** 一个可以监听上传进度变化事件,以及取消上传任务的对象
95
- * @supported weapp, swan, alipay, h5, rn, tt
87
+ * @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
96
88
  * @example
97
89
  * ```tsx
98
90
  * const uploadTask = Taro.uploadFile({
@@ -120,12 +112,12 @@ declare module '../../index' {
120
112
  */
121
113
  interface UploadTask {
122
114
  /** 中断上传任务
123
- * @supported weapp, h5, tt
115
+ * @supported weapp, h5, tt, harmony_hybrid
124
116
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html
125
117
  */
126
118
  abort(): void
127
119
  /** 监听上传进度变化事件
128
- * @supported weapp, h5, tt
120
+ * @supported weapp, h5, tt, harmony_hybrid
129
121
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html
130
122
  */
131
123
  onProgressUpdate(
@@ -133,15 +125,15 @@ declare module '../../index' {
133
125
  callback: UploadTask.OnProgressUpdateCallback,
134
126
  ): void
135
127
  /** 取消监听上传进度变化事件
136
- * @supported weapp, h5, tt
128
+ * @supported weapp, h5, tt, harmony_hybrid
137
129
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html
138
130
  */
139
131
  offProgressUpdate(
140
132
  /** 上传进度变化事件的回调函数 */
141
- callback: UploadTask.OffProgressUpdateCallback,
133
+ callback: UploadTask.OnProgressUpdateCallback,
142
134
  ): void
143
135
  /** 监听 HTTP Response Header 事件。会比请求完成事件更早
144
- * @supported weapp, h5
136
+ * @supported weapp, h5, harmony_hybrid
145
137
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html
146
138
  */
147
139
  onHeadersReceived(
@@ -149,18 +141,18 @@ declare module '../../index' {
149
141
  callback: UploadTask.OnHeadersReceivedCallback,
150
142
  ): void
151
143
  /** 取消监听 HTTP Response Header 事件
152
- * @supported weapp, h5
144
+ * @supported weapp, h5, harmony_hybrid
153
145
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html
154
146
  */
155
147
  offHeadersReceived(
156
148
  /** HTTP Response Header 事件的回调函数 */
157
- callback: UploadTask.OffHeadersReceivedCallback,
149
+ callback: UploadTask.OnHeadersReceivedCallback,
158
150
  ): void
159
151
  }
160
152
 
161
153
  interface TaroStatic {
162
154
  /** 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
163
- * @supported weapp, swan, alipay, h5, rn, tt
155
+ * @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
164
156
  * @example
165
157
  * ```tsx
166
158
  * Taro.chooseImage({
@@ -138,22 +138,22 @@ declare module '../../index' {
138
138
  }
139
139
 
140
140
  /** WebSocket 任务,可通过 [Taro.connectSocket()](/docs/apis/network/websocket/SocketTask) 接口创建返回。
141
- * @supported weapp, h5, rn, alipay, swan
141
+ * @supported weapp, h5, rn, alipay, swan, harmony_hybrid
142
142
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html
143
143
  */
144
144
  interface SocketTask {
145
145
  /** 通过 WebSocket 连接发送数据
146
- * @supported weapp, h5, rn, alipay, swan, tt
146
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
147
147
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html
148
148
  */
149
149
  send(option: SocketTask.SendOption): void
150
150
  /** 关闭 WebSocket 连接
151
- * @supported weapp, h5, rn, alipay, swan, tt
151
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
152
152
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html
153
153
  */
154
154
  close(option: SocketTask.CloseOption): void
155
155
  /** 监听 WebSocket 连接打开事件
156
- * @supported weapp, h5, rn, alipay, swan, tt
156
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
157
157
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html
158
158
  */
159
159
  onOpen(
@@ -161,7 +161,7 @@ declare module '../../index' {
161
161
  callback: SocketTask.OnOpenCallback
162
162
  ): void
163
163
  /** 监听 WebSocket 连接关闭事件
164
- * @supported weapp, h5, rn, alipay, swan, tt
164
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
165
165
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html
166
166
  */
167
167
  onClose(
@@ -169,7 +169,7 @@ declare module '../../index' {
169
169
  callback: SocketTask.OnCloseCallback
170
170
  ): void
171
171
  /** 监听 WebSocket 错误事件
172
- * @supported weapp, h5, rn, alipay, swan, tt
172
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
173
173
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html
174
174
  */
175
175
  onError(
@@ -177,7 +177,7 @@ declare module '../../index' {
177
177
  callback: SocketTask.OnErrorCallback
178
178
  ): void
179
179
  /** 监听 WebSocket 接受到服务器的消息事件
180
- * @supported weapp, h5, rn, alipay, swan, tt
180
+ * @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
181
181
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html
182
182
  */
183
183
  onMessage<T = any>(
@@ -320,7 +320,7 @@ declare module '../../index' {
320
320
  * **并发数**
321
321
  * - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
322
322
  * - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
323
- * @supported weapp, h5, rn, alipay, swan
323
+ * @supported weapp, h5, rn, alipay, swan, harmony_hybrid
324
324
  * @example
325
325
  * ```tsx
326
326
  * Taro.connectSocket({
@@ -35,7 +35,7 @@ declare module '../../index' {
35
35
 
36
36
  interface TaroStatic {
37
37
  /** 获取当前帐号信息
38
- * @supported weapp
38
+ * @supported weapp, alipay, qq
39
39
  * @example
40
40
  * ```tsx
41
41
  * const accountInfo = Taro.getAccountInfoSync();
@@ -14,7 +14,9 @@ declare module '../../index' {
14
14
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
15
15
  /** 收货人姓名 */
16
16
  userName: string
17
- /** 邮编 */
17
+ /** 邮编
18
+ * @supported weapp, qq
19
+ */
18
20
  postalCode: string
19
21
  /** 国标收货地址第一级地址 */
20
22
  provinceName: string
@@ -22,13 +24,19 @@ declare module '../../index' {
22
24
  cityName: string
23
25
  /** 国标收货地址第三级地址 */
24
26
  countyName: string
25
- /** 国标收货地址第四级地址 */
27
+ /** 国标收货地址第四级地址
28
+ * @supported weapp, qq
29
+ */
26
30
  streetName: string
27
31
  /** 详细收货地址信息 */
28
32
  detailInfo: string
29
- /** 新选择器详细收货地址信息 */
33
+ /** 新选择器详细收货地址信息
34
+ * @supported weapp, qq
35
+ */
30
36
  detailInfoNew: string
31
- /** 收货地址国家码 */
37
+ /** 收货地址国家码
38
+ * @supported weapp, qq
39
+ */
32
40
  nationalCode: string
33
41
  /** 收货人手机号码 */
34
42
  telNumber: string
@@ -37,7 +45,7 @@ declare module '../../index' {
37
45
 
38
46
  interface TaroStatic {
39
47
  /** 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
40
- * @supported weapp, tt
48
+ * @supported weapp, qq, tt, jd
41
49
  * @example
42
50
  * ```tsx
43
51
  * Taro.chooseAddress({
@@ -55,7 +55,7 @@ declare module '../../index' {
55
55
  authorizeForMiniProgram(option: authorizeForMiniProgram.Option): Promise<TaroGeneral.CallbackResult>
56
56
 
57
57
  /** 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
58
- * @supported weapp, rn, tt
58
+ * @supported weapp, swan, qq, tt, rn
59
59
  * @example
60
60
  * ```tsx
61
61
  * // 可以通过 Taro.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
@@ -118,6 +118,8 @@ declare module '../../index' {
118
118
  nickname: string
119
119
  /** 是否可预约 */
120
120
  reservable: boolean
121
+ /** 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)。 */
122
+ otherInfos?: string[]
121
123
  }
122
124
  interface Status {
123
125
  /** 可用 */
@@ -154,6 +156,10 @@ declare module '../../index' {
154
156
  headUrl: string
155
157
  /** 视频号昵称 */
156
158
  nickname: string
159
+ /** 直播回放状态 */
160
+ replayStatus: keyof ReplayStatus | number
161
+ /** 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)。 */
162
+ otherInfos?: string[]
157
163
  }
158
164
  interface Status {
159
165
  /** 直播中 */
@@ -161,6 +167,16 @@ declare module '../../index' {
161
167
  /** 直播结束 */
162
168
  3
163
169
  }
170
+ interface ReplayStatus {
171
+ /** 未生成 */
172
+ 0
173
+ /** 已生成 */
174
+ 1
175
+ /** 生成中 */
176
+ 3
177
+ /** 已过期 */
178
+ 6
179
+ }
164
180
  }
165
181
 
166
182
  interface TaroStatic {
@@ -20,7 +20,7 @@ declare module '../../index' {
20
20
  /** 接口调用失败的回调函数 */
21
21
  fail?: (res: TaroGeneral.CallbackResult) => void
22
22
  /** 接口调用成功的回调函数 */
23
- success?: (result: SuccessCallbackResult) => void
23
+ success?: (result: TaroGeneral.CallbackResult) => void
24
24
  }
25
25
  }
26
26
 
@@ -50,14 +50,54 @@ declare module '../../index' {
50
50
 
51
51
  interface TaroStatic {
52
52
  /** 请求用户授权与设备(组)间进行音视频通话
53
+ * @example
54
+ * ```tsx
55
+ * // 授权单台设备
56
+ * Taro.requestDeviceVoIP({
57
+ * sn: 'xxxx',
58
+ * snTicket: 'xxxxx',
59
+ * modelId: 'xxx',
60
+ * deviceName: 'xxx',
61
+ * success(res) {
62
+ * console.log(res)
63
+ * },
64
+ * fail(res) {
65
+ * console.log(res)
66
+ * }
67
+ * })
68
+ *
69
+ * // 批量授权(授权设备组)
70
+ * Taro.requestDeviceVoIP({
71
+ * isGroup: true,
72
+ * groupId: '设备组 ID',
73
+ * success(res) {
74
+ * console.log(res)
75
+ * },
76
+ * fail(res) {
77
+ * console.log(res)
78
+ * }
79
+ * })
80
+ * ```
81
+ *
53
82
  * @supported weapp
54
83
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.requestDeviceVoIP.html
55
84
  */
56
85
  requestDeviceVoIP(option: requestDeviceVoIP.Option): Promise<TaroGeneral.CallbackResult>
57
86
  /** 查询当前用户授权的音视频通话设备(组)信息
58
87
  * @supported weapp
88
+ * @example
89
+ * ```tsx
90
+ * Taro.getDeviceVoIPList({
91
+ * success(res) {
92
+ * console.log(res)
93
+ * },
94
+ * fail(res) {
95
+ * console.log(res)
96
+ * }
97
+ * })
98
+ * ```
59
99
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html
60
100
  */
61
101
  getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
62
102
  }
63
- }
103
+ }
@@ -75,7 +75,7 @@ declare module '../../index' {
75
75
  * 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档
76
76
  * @supported weapp
77
77
  * @example
78
- ```tsx
78
+ * ```tsx
79
79
  * Taro.chooseInvoice({
80
80
  * success: function (res) {}
81
81
  * })
@@ -26,12 +26,25 @@ declare module '../../index' {
26
26
  success?: (result: SuccessCallbackResult) => void
27
27
  /** 超时时间,单位ms */
28
28
  timeout?: number
29
+ /** 未登录时, 是否强制调起登录框
30
+ * @supported tt
31
+ * @default true
32
+ */
33
+ force?: boolean
29
34
  }
30
35
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
31
36
  /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
32
37
  code: string
33
38
  /** 调用结果 */
34
39
  errMsg: string
40
+ /** 用于标识当前设备, 无论登录与否都会返回, 有效期 5 分钟。
41
+ * @supported tt
42
+ */
43
+ anonymousCode?: string
44
+ /** 判断在当前 APP(头条、抖音等)是否处于登录状态。
45
+ * @supported tt
46
+ */
47
+ isLogin?: boolean
35
48
  }
36
49
  }
37
50
 
@@ -54,7 +67,7 @@ declare module '../../index' {
54
67
  pluginLogin(option?: pluginLogin.Option): Promise<pluginLogin.SuccessCallbackResult>
55
68
 
56
69
  /** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
57
- * @supported weapp
70
+ * @supported weapp, jd, qq, tt, harmony_hybrid
58
71
  * @example
59
72
  * ```tsx
60
73
  * Taro.login({
@@ -81,8 +94,8 @@ declare module '../../index' {
81
94
  *
82
95
  * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
83
96
  *
84
- * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
85
- * @supported weapp
97
+ * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
98
+ * @supported weapp, swan, qq, tt
86
99
  * @example
87
100
  * ```tsx
88
101
  * Taro.checkSession({
@@ -8,7 +8,7 @@ declare module '../../index' {
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用成功的回调函数 */
11
- success?: (res: TaroGeneral.CallbackResult) => void
11
+ success?: (res: SuccessCallbackResult) => void
12
12
  }
13
13
 
14
14
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
@@ -23,6 +23,6 @@ declare module '../../index' {
23
23
  * @supported weapp
24
24
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
25
25
  */
26
- checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
26
+ checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
27
27
  }
28
28
  }