@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
@@ -49,6 +49,10 @@ declare module '../../index' {
49
49
  keys: string[]
50
50
  /** 限制的空间大小,单位 KB */
51
51
  limitSize: number
52
+ /** 是否执行成功
53
+ * @supported alipay
54
+ */
55
+ success?: boolean
52
56
  }
53
57
  }
54
58
 
@@ -102,9 +106,54 @@ declare module '../../index' {
102
106
  }
103
107
  }
104
108
 
109
+ namespace batchSetStorageSync {
110
+ interface Option {
111
+ /** [{ key, value }] */
112
+ kvList: kv[]
113
+ }
114
+ interface kv {
115
+ /** key 本地缓存中指定的 key */
116
+ key: string
117
+ /** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
118
+ value: any
119
+ }
120
+ }
121
+
122
+ namespace batchSetStorage {
123
+ interface Option {
124
+ /** [{ key, value }] */
125
+ kvList: kv[]
126
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
127
+ complete?: (res: TaroGeneral.CallbackResult) => void
128
+ /** 接口调用失败的回调函数 */
129
+ fail?: (res: TaroGeneral.CallbackResult) => void
130
+ /** 接口调用成功的回调函数 */
131
+ success?: (res: TaroGeneral.CallbackResult) => void
132
+ }
133
+ interface kv {
134
+ /** key 本地缓存中指定的 key */
135
+ key: string
136
+ /** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
137
+ value: any
138
+ }
139
+ }
140
+
141
+ namespace batchGetStorage {
142
+ interface Option {
143
+ /** 本地缓存中指定的 keyList */
144
+ keyList: string[]
145
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
146
+ complete?: (res: TaroGeneral.CallbackResult) => void
147
+ /** 接口调用失败的回调函数 */
148
+ fail?: (res: TaroGeneral.CallbackResult) => void
149
+ /** 接口调用成功的回调函数 */
150
+ success?: (res: TaroGeneral.CallbackResult) => void
151
+ }
152
+ }
153
+
105
154
  interface TaroStatic {
106
155
  /** Taro.setStorage 的同步版本
107
- * @supported weapp, h5, tt
156
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
108
157
  * @example
109
158
  * ```tsx
110
159
  * Taro.setStorage({
@@ -128,7 +177,7 @@ declare module '../../index' {
128
177
  ): void
129
178
 
130
179
  /** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
131
- * @supported weapp, h5, rn, tt
180
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
132
181
  * @example
133
182
  * ```tsx
134
183
  * Taro.setStorage({
@@ -155,7 +204,7 @@ declare module '../../index' {
155
204
  ): void
156
205
 
157
206
  /** Taro.removeStorage 的同步版本
158
- * @supported weapp, h5, tt
207
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
159
208
  * @example
160
209
  * ```tsx
161
210
  * try {
@@ -172,7 +221,7 @@ declare module '../../index' {
172
221
  ): void
173
222
 
174
223
  /** 从本地缓存中移除指定 key
175
- * @supported weapp, h5, rn, tt
224
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
176
225
  * @example
177
226
  * ```tsx
178
227
  * Taro.removeStorage({
@@ -187,7 +236,7 @@ declare module '../../index' {
187
236
  removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
188
237
 
189
238
  /** Taro.getStorage 的同步版本
190
- * @supported weapp, h5, tt
239
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
191
240
  * @example
192
241
  * ```tsx
193
242
  * try {
@@ -207,7 +256,7 @@ declare module '../../index' {
207
256
  ): T
208
257
 
209
258
  /** Taro.getStorageInfo 的同步版本
210
- * @supported weapp, h5, rn, tt
259
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
211
260
  * @example
212
261
  * ```tsx
213
262
  * try {
@@ -224,7 +273,7 @@ declare module '../../index' {
224
273
  getStorageInfoSync(): getStorageInfoSync.Option
225
274
 
226
275
  /** 异步获取当前storage的相关信息
227
- * @supported weapp, h5, rn, tt
276
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony_hybrid
228
277
  * @example
229
278
  * ```tsx
230
279
  * Taro.getStorageInfo({
@@ -240,7 +289,7 @@ declare module '../../index' {
240
289
  getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
241
290
 
242
291
  /** 从本地缓存中异步获取指定 key 的内容
243
- * @supported weapp, h5, rn, tt
292
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
244
293
  * @example
245
294
  * ```tsx
246
295
  * Taro.getStorage({
@@ -264,7 +313,7 @@ declare module '../../index' {
264
313
  ): void
265
314
 
266
315
  /** Taro.clearStorage 的同步版本
267
- * @supported weapp, h5, tt
316
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
268
317
  * @example
269
318
  * ```tsx
270
319
  * try {
@@ -278,7 +327,7 @@ declare module '../../index' {
278
327
  clearStorageSync(): void
279
328
 
280
329
  /** 清理本地数据缓存
281
- * @supported weapp, h5, rn, tt
330
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
282
331
  * @example
283
332
  * ```tsx
284
333
  * Taro.clearStorage()
@@ -286,5 +335,71 @@ declare module '../../index' {
286
335
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html
287
336
  */
288
337
  clearStorage(option?: clearStorage.Option): Promise<TaroGeneral.CallbackResult>
338
+
339
+ /** 将数据批量存储在本地缓存中指定的 key 中。
340
+ * 会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
341
+ * 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
342
+ * @supported weapp
343
+ * @example
344
+ * ```tsx
345
+ * try {
346
+ * Taro.batchSetStorageSync([{key: 'key', value: 'value'}])
347
+ * } catch (e) { }
348
+ * ```
349
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
350
+ */
351
+ batchSetStorageSync(option: batchSetStorageSync.Option): void
352
+
353
+ /** 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。
354
+ * 除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
355
+ * 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
356
+ * @supported weapp
357
+ * @example
358
+ * ```tsx
359
+ * Taro.batchGetStorage({
360
+ * keyList: ['key']
361
+ * success(res) {
362
+ * console.log(res)
363
+ * }
364
+ * })
365
+ * ```
366
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
367
+ */
368
+ batchSetStorage(option: batchSetStorage.Option): Promise<TaroGeneral.CallbackResult>
369
+
370
+ /** 从本地缓存中同步批量获取指定 key 的内容。
371
+ * @supported weapp
372
+ * @example
373
+ * ```tsx
374
+ * try {
375
+ * var valueList = Taro.batchGetStorageSync(['key'])
376
+ * if (valueList) {
377
+ * // Do something with return value
378
+ * }
379
+ * } catch (e) {
380
+ * // Do something when catch error
381
+ * }
382
+ * ```
383
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
384
+ */
385
+ batchGetStorageSync<T = any>(
386
+ /** 本地缓存中指定的 key 数组 */
387
+ keyList: string[]
388
+ ): T[]
389
+
390
+ /** 从本地缓存中异步批量获取指定 key 的内容。
391
+ * @supported weapp
392
+ * @example
393
+ * ```tsx
394
+ * Taro.batchGetStorage({
395
+ * keyList: ['key'],
396
+ * success(res) {
397
+ * console.log(res)
398
+ * }
399
+ * })
400
+ * ```
401
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
402
+ */
403
+ batchGetStorage(option: batchGetStorage.Option): Promise<TaroGeneral.CallbackResult>
289
404
  }
290
405
  }
@@ -0,0 +1,307 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace insertBookshelf {
5
+ interface Option {
6
+ /** 添加的内容分类 */
7
+ category: keyof Category | string
8
+ /** 要添加到书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
9
+ contentIds: string[]
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: SuccessCallbackResult) => void
16
+ }
17
+ interface Category {
18
+ /** 专栏模板 */
19
+ article
20
+ /** 文档模板 */
21
+ doc
22
+ /** 动漫模板 */
23
+ cartoon
24
+ /** 影音模板 */
25
+ av
26
+ }
27
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
28
+ /** 添加到书架的结果列表 */
29
+ list: IListItem[]
30
+ }
31
+ interface IListItem {
32
+ /** 内容的唯一标识 */
33
+ contentId: string
34
+ /** 添加状态:值为 0 时是失败,为 1 时是成功 */
35
+ status: keyof Status
36
+ /** 添加信息 */
37
+ msg: string
38
+ }
39
+ interface Status {
40
+ /** 失败 */
41
+ 0
42
+ /** 成功 */
43
+ 1
44
+ }
45
+ }
46
+
47
+ namespace deleteBookshelf {
48
+ interface Option {
49
+ /** 要删除的内容分类 */
50
+ category: keyof Category | string
51
+ /** 要删除书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符)。支持批量删除的同一个 category 下的多个 id,不同 category 下的 id 请分别调用该接口删除 */
52
+ contentIds: string[]
53
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
+ complete?: (res: TaroGeneral.CallbackResult) => void
55
+ /** 接口调用失败的回调函数 */
56
+ fail?: (res: TaroGeneral.CallbackResult) => void
57
+ /** 接口调用成功的回调函数 */
58
+ success?: (res: SuccessCallbackResult) => void
59
+ }
60
+ interface Category {
61
+ /** 专栏模板 */
62
+ article
63
+ /** 文档模板 */
64
+ doc
65
+ /** 动漫模板 */
66
+ cartoon
67
+ /** 影音模板 */
68
+ av
69
+ }
70
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
71
+ /** 添加到书架的结果列表 */
72
+ list: IListItem[]
73
+ }
74
+ interface IListItem {
75
+ /** 内容的唯一标识 */
76
+ contentId: string
77
+ /** 删除状态:值为 0 时是失败,为 1 时是成功 */
78
+ status: keyof Status
79
+ /** 删除信息 */
80
+ msg: string
81
+ }
82
+ interface Status {
83
+ /** 失败 */
84
+ 0
85
+ /** 成功 */
86
+ 1
87
+ }
88
+ }
89
+
90
+ namespace queryBookshelf {
91
+ interface Option {
92
+ /** 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
93
+ contentIds: string[]
94
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
+ complete?: (res: TaroGeneral.CallbackResult) => void
96
+ /** 接口调用失败的回调函数 */
97
+ fail?: (res: TaroGeneral.CallbackResult) => void
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: TaroGeneral.CallbackResult) => void
100
+ }
101
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
102
+ /** 查询的内容结果列表 */
103
+ list: IListItem[]
104
+ }
105
+ interface IListItem {
106
+ /** 内容的唯一标识 */
107
+ contentId: string
108
+ /** 状态 */
109
+ status: keyof Status
110
+ }
111
+ interface Status {
112
+ /** 不存在 */
113
+ 0
114
+ /** 存在 */
115
+ 1
116
+ }
117
+ }
118
+
119
+ namespace updateBookshelfReadTime {
120
+ interface Option {
121
+ /** 添加的内容分类 */
122
+ category: keyof Category | string
123
+ /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
+ contentIds: string[]
125
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
+ complete?: (res: TaroGeneral.CallbackResult) => void
127
+ /** 接口调用失败的回调函数 */
128
+ fail?: (res: TaroGeneral.CallbackResult) => void
129
+ /** 接口调用成功的回调函数 */
130
+ success?: (res: SuccessCallbackResult) => void
131
+ }
132
+ interface Category {
133
+ /** 专栏模板 */
134
+ article
135
+ /** 文档模板 */
136
+ doc
137
+ /** 动漫模板 */
138
+ cartoon
139
+ /** 影音模板 */
140
+ av
141
+ }
142
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
143
+ /** 更新状态 */
144
+ status: keyof Status
145
+ /** 更新的结果信息 */
146
+ msg: string
147
+ }
148
+ interface Status {
149
+ /** 失败 */
150
+ 0
151
+ /** 成功 */
152
+ 1
153
+ }
154
+ }
155
+
156
+ namespace navigateToBookshelf {
157
+ interface Option {
158
+ /** 跳转到指定的内容分类
159
+ * @supported swan
160
+ */
161
+ category: keyof Category | string
162
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
+ complete?: (res: TaroGeneral.CallbackResult) => void
164
+ /** 接口调用失败的回调函数 */
165
+ fail?: (res: TaroGeneral.CallbackResult) => void
166
+ /** 接口调用成功的回调函数 */
167
+ success?: (res: TaroGeneral.CallbackResult) => void
168
+ }
169
+ interface Category {
170
+ /** 专栏模板 */
171
+ article
172
+ /** 文档模板 */
173
+ doc
174
+ /** 动漫模板 */
175
+ cartoon
176
+ /** 影音模板 */
177
+ av
178
+ }
179
+ }
180
+
181
+ interface TaroStatic {
182
+ /** 添加内容到宿主书架
183
+ * @supported swan, qq
184
+ * @swan (需宿主支持书架入口)
185
+ * @example
186
+ * ```tsx
187
+ * Taro.insertBookshelf({
188
+ * category: 'doc',
189
+ * contentIds: ['test1', 'test2'],
190
+ * success(res) {
191
+ * Taro.showModal({
192
+ * title: 'success',
193
+ * content: JSON.stringify(res)
194
+ * })
195
+ * },
196
+ * fail(err) {
197
+ * Taro.showModal({
198
+ * title: 'fail',
199
+ * content: JSON.stringify(err)
200
+ * })
201
+ * }
202
+ * })
203
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-insertBookshelf/
204
+ */
205
+ insertBookshelf(option: insertBookshelf.Option): void
206
+
207
+ /** 删除书架中的内容(需宿主支持书架入口)
208
+ * @supported swan
209
+ * @example
210
+ * ```tsx
211
+ * Taro.deleteBookshelf({
212
+ * category: 'doc',
213
+ * contentIds: ['test1', 'test2'],
214
+ * success(res) {
215
+ * Taro.showModal({
216
+ * title: 'success',
217
+ * content: JSON.stringify(res)
218
+ * })
219
+ * },
220
+ * fail(err) {
221
+ * Taro.showModal({
222
+ * title: 'fail',
223
+ * content: JSON.stringify(err)
224
+ * })
225
+ * }
226
+ * })
227
+ * ```
228
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-deleteBookshelf/
229
+ */
230
+ deleteBookshelf(option: deleteBookshelf.Option): void
231
+
232
+ /** 查询宿主书架的相关内容
233
+ * @supported swan, qq
234
+ * @swan (需宿主支持书架入口)
235
+ * @example
236
+ * ```tsx
237
+ * Taro.queryBookshelf({
238
+ * contentIds: ['test1', 'test2'],
239
+ * success(res) {
240
+ * Taro.showModal({
241
+ * title: 'success',
242
+ * content: JSON.stringify(res)
243
+ * })
244
+ * },
245
+ * fail(err) {
246
+ * Taro.showModal({
247
+ * title: 'fail',
248
+ * content: JSON.stringify(err)
249
+ * })
250
+ * }
251
+ * })
252
+ * ```
253
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
254
+ */
255
+ queryBookshelf(option: queryBookshelf.Option): void
256
+
257
+ /** 更新已加入宿主书架的内容的阅读时间
258
+ * @supported swan, qq
259
+ * @swan (需宿主支持书架入口)
260
+ * @example
261
+ * ```tsx
262
+ * Taro.updateBookshelfReadTime({
263
+ * category: 'doc',
264
+ * contentIds: 'test1',
265
+ * success(res) {
266
+ * Taro.showModal({
267
+ * title: 'success',
268
+ * content: JSON.stringify(res)
269
+ * })
270
+ * },
271
+ * fail(err) {
272
+ * Taro.showModal({
273
+ * title: 'fail',
274
+ * content: JSON.stringify(err)
275
+ * })
276
+ * }
277
+ * })
278
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
+ */
280
+ updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
+
282
+ /** 跳转到宿主书架
283
+ * @supported swan
284
+ * @swan (需宿主支持书架入口)
285
+ * @example
286
+ * ```tsx
287
+ * Taro.navigateToBookshelf({
288
+ * category: 'article',
289
+ * contentIds: 'test1',
290
+ * success(res) {
291
+ * Taro.showModal({
292
+ * title: 'navigateToBookshelf',
293
+ * content: 'success'
294
+ * })
295
+ * },
296
+ * fail(err) {
297
+ * Taro.showModal({
298
+ * title: 'fail',
299
+ * content: JSON.stringify(err)
300
+ * })
301
+ * }
302
+ * })
303
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-navigateToBookshelf/
304
+ */
305
+ navigateToBookshelf(option: navigateToBookshelf.Option): void
306
+ }
307
+ }
@@ -0,0 +1,80 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace downloadPackage {
5
+ interface Option {
6
+ /** 预下载的小程序的 appKey */
7
+ appKey: string
8
+ /** 预下载的小程序的 pageUrl ,默认值为小程序的首页页面 */
9
+ pageUrl?: string
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (res: TaroGeneral.CallbackResult) => any
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (err: TaroGeneral.CallbackResult) => any
14
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
15
+ complete?: (res: TaroGeneral.CallbackResult) => any
16
+ }
17
+ }
18
+
19
+ namespace downloadPackages {
20
+ interface Option {
21
+ /** 预下载的小程序的列表。 */
22
+ pageList: IPageItem[]
23
+ /** 接口调用成功的回调函数 */
24
+ success?: (res: SuccessCallbackResult) => any
25
+ /** 接口调用失败的回调函数 */
26
+ fail?: (err: TaroGeneral.CallbackResult) => any
27
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
+ complete?: (res: TaroGeneral.CallbackResult) => any
29
+ }
30
+ interface IPageItem {
31
+ /** 预下载的小程序的 appKey */
32
+ appKey: string
33
+ /** 页面路径 */
34
+ pages: string[]
35
+ }
36
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
37
+ /** 小程序包预下载结果回调 */
38
+ [key: string]: IAppKeyResult[]
39
+ }
40
+ interface IAppKeyResult {
41
+ /** 页面路径 */
42
+ pageUrl: string
43
+ /** 预下载能力调用结果。值为 "0" 时是成功,非 "0" 时是失败 */
44
+ status: string
45
+ /** 预下载结果信息 */
46
+ message: string
47
+ }
48
+ }
49
+
50
+ namespace loadSubPackage {
51
+ interface Option {
52
+ /** 接口调用成功的回调函数 */
53
+ success?: (res: TaroGeneral.CallbackResult) => any
54
+ /** 接口调用失败的回调函数 */
55
+ fail?: (err: TaroGeneral.CallbackResult) => any
56
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
57
+ complete?: (res: TaroGeneral.CallbackResult) => any
58
+ }
59
+ }
60
+
61
+ interface TaroStatic {
62
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
63
+ * Web 态说明:Web 态不支持预下载的能力。
64
+ * @supported swan
65
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackage/
66
+ */
67
+ downloadPackage(option: downloadPackage.Option): void
68
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
69
+ * Web 态说明:Web 态不支持预下载的能力。
70
+ * @supported swan
71
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackages/
72
+ */
73
+ downloadPackages(option: downloadPackages.Option): void
74
+ /** 提前下载好子包的资源,目录结构配置参考[分包加载](https://smartprogram.baidu.com/docs/develop/framework/subpackages/)。
75
+ * @supported swan
76
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-loadSubPackage/
77
+ */
78
+ loadSubPackage(option: loadSubPackage.Option): void
79
+ }
80
+ }