@tarojs/taro 3.3.12 → 3.4.0-beta.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 (97) hide show
  1. package/package.json +5 -5
  2. package/types/api/ad/index.d.ts +34 -28
  3. package/types/api/alipay/index.d.ts +11 -7
  4. package/types/api/base/debug.d.ts +60 -54
  5. package/types/api/base/env.d.ts +12 -8
  6. package/types/api/base/index.d.ts +87 -83
  7. package/types/api/base/system.d.ts +59 -54
  8. package/types/api/base/update.d.ts +37 -33
  9. package/types/api/base/weapp/app-event.d.ts +147 -131
  10. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  11. package/types/api/canvas/index.d.ts +115 -110
  12. package/types/api/cloud/index.d.ts +99 -94
  13. package/types/api/data-analysis/index.d.ts +68 -64
  14. package/types/api/device/accelerometer.d.ts +57 -50
  15. package/types/api/device/battery.d.ts +19 -15
  16. package/types/api/device/ble.d.ts +241 -228
  17. package/types/api/device/bluetooth.d.ts +207 -194
  18. package/types/api/device/clipboard.d.ts +48 -43
  19. package/types/api/device/compass.d.ts +55 -48
  20. package/types/api/device/contact.d.ts +13 -9
  21. package/types/api/device/gyroscope.d.ts +41 -35
  22. package/types/api/device/iBeacon.d.ts +79 -73
  23. package/types/api/device/motion.d.ts +42 -37
  24. package/types/api/device/network.d.ts +80 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +32 -18
  27. package/types/api/device/phone.d.ts +20 -15
  28. package/types/api/device/scan.d.ts +31 -26
  29. package/types/api/device/screen.d.ts +74 -67
  30. package/types/api/device/vibrate.d.ts +31 -25
  31. package/types/api/device/wifi.d.ts +151 -140
  32. package/types/api/ext/index.d.ts +44 -39
  33. package/types/api/files/index.d.ts +219 -209
  34. package/types/api/framework/index.d.ts +25 -20
  35. package/types/api/location/index.d.ts +140 -136
  36. package/types/api/media/audio.d.ts +135 -127
  37. package/types/api/media/background-audio.d.ts +135 -126
  38. package/types/api/media/camera.d.ts +30 -26
  39. package/types/api/media/editor.d.ts +35 -33
  40. package/types/api/media/image.d.ts +161 -150
  41. package/types/api/media/live.d.ts +88 -82
  42. package/types/api/media/map.d.ts +47 -43
  43. package/types/api/media/recorder.d.ts +90 -84
  44. package/types/api/media/video-processing.d.ts +10 -6
  45. package/types/api/media/video.d.ts +63 -58
  46. package/types/api/network/download.d.ts +34 -30
  47. package/types/api/network/mdns.d.ts +104 -91
  48. package/types/api/network/request.d.ts +83 -79
  49. package/types/api/network/udp.d.ts +20 -16
  50. package/types/api/network/upload.d.ts +60 -56
  51. package/types/api/network/websocket.d.ts +201 -194
  52. package/types/api/open-api/account.d.ts +18 -14
  53. package/types/api/open-api/address.d.ts +27 -23
  54. package/types/api/open-api/authorize.d.ts +30 -26
  55. package/types/api/open-api/card.d.ts +55 -51
  56. package/types/api/open-api/customer-service.d.ts +21 -17
  57. package/types/api/open-api/facial.d.ts +28 -24
  58. package/types/api/open-api/invoice.d.ts +38 -34
  59. package/types/api/open-api/login.d.ts +56 -52
  60. package/types/api/open-api/navigate.d.ts +79 -75
  61. package/types/api/open-api/payment.d.ts +34 -30
  62. package/types/api/open-api/settings.d.ts +49 -45
  63. package/types/api/open-api/soter.d.ts +92 -86
  64. package/types/api/open-api/subscribe-message.d.ts +24 -20
  65. package/types/api/open-api/user-info.d.ts +60 -57
  66. package/types/api/open-api/werun.d.ts +50 -46
  67. package/types/api/route/index.d.ts +122 -118
  68. package/types/api/share/index.d.ts +68 -64
  69. package/types/api/storage/background-fetch.d.ts +40 -35
  70. package/types/api/storage/index.d.ts +267 -262
  71. package/types/api/swan/index.d.ts +47 -42
  72. package/types/api/ui/animation.d.ts +21 -17
  73. package/types/api/ui/background.d.ts +38 -34
  74. package/types/api/ui/custom-component.d.ts +22 -18
  75. package/types/api/ui/fonts.d.ts +26 -21
  76. package/types/api/ui/interaction.d.ts +167 -121
  77. package/types/api/ui/keyboard.d.ts +59 -55
  78. package/types/api/ui/menu.d.ts +10 -6
  79. package/types/api/ui/navigation-bar.d.ts +67 -63
  80. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  81. package/types/api/ui/scroll.d.ts +30 -26
  82. package/types/api/ui/sticky.d.ts +22 -19
  83. package/types/api/ui/tab-bar.d.ts +101 -97
  84. package/types/api/ui/window.d.ts +24 -18
  85. package/types/api/worker/index.d.ts +28 -24
  86. package/types/api/wxml/index.d.ts +42 -38
  87. package/types/global.d.ts +390 -0
  88. package/types/index.d.ts +12 -98
  89. package/types/taro.api.d.ts +94 -0
  90. package/types/taro.component.d.ts +10 -57
  91. package/types/taro.config.d.ts +24 -6
  92. package/types/taro.extend.d.ts +52 -75
  93. package/types/taro.hooks.d.ts +68 -67
  94. package/types/taro.lifecycle.d.ts +47 -28
  95. package/types/api/ad/index.ts +0 -6
  96. package/types/api/alipay/index.ts +0 -7
  97. package/types/api/index.d.ts +0 -352
@@ -1,28 +1,6 @@
1
- declare namespace Taro {
2
- /** Taro.setStorage 的同步版本
3
- * @supported weapp, h5
4
- * @example
5
- * ```tsx
6
- * Taro.setStorage({
7
- * key:"key",
8
- * data:"value"
9
- * })
10
- * ```
11
- * @example
12
- * ```tsx
13
- * try {
14
- * Taro.setStorageSync('key', 'value')
15
- * } catch (e) { }
16
- * ```
17
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html
18
- */
19
- function setStorageSync(
20
- /** 本地缓存中指定的 key */
21
- key: string,
22
- /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
23
- data: any,
24
- ): void
1
+ import Taro from '../../index'
25
2
 
3
+ declare module '../../index' {
26
4
  namespace setStorage {
27
5
  interface Option {
28
6
  /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
@@ -30,135 +8,26 @@ declare namespace Taro {
30
8
  /** 本地缓存中指定的 key */
31
9
  key: string
32
10
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
33
- complete?: (res: General.CallbackResult) => void
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
34
12
  /** 接口调用失败的回调函数 */
35
- fail?: (res: General.CallbackResult) => void
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
36
14
  /** 接口调用成功的回调函数 */
37
- success?: (res: General.CallbackResult) => void
15
+ success?: (res: TaroGeneral.CallbackResult) => void
38
16
  }
39
17
  }
40
18
 
41
- /** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
42
- * @supported weapp, h5, rn
43
- * @example
44
- * ```tsx
45
- * Taro.setStorage({
46
- * key:"key",
47
- * data:"value"
48
- * })
49
- * ```
50
- * ```tsx
51
- * try {
52
- * Taro.setStorageSync('key', 'value')
53
- * } catch (e) { }
54
- * ```
55
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html
56
- */
57
- function setStorage(option: setStorage.Option): Promise<General.CallbackResult>
58
-
59
- /**
60
- * 从本地缓存中同步移除指定 key 。
61
- * @supported weapp, h5
62
- * @example
63
- * ```tsx
64
- * try {
65
- * Taro.removeStorageSync('key')
66
- * } catch (e) {
67
- * // Do something when catch error
68
- * }
69
- * ```
70
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html
71
- */
72
- function removeStorageSync(key: string): void
73
-
74
- /** Taro.removeStorage 的同步版本
75
- * @example
76
- * ```tsx
77
- * Taro.removeStorage({
78
- * key: 'key',
79
- * success: function (res) {
80
- * console.log(res)
81
- * }
82
- * })
83
- * ```
84
- *
85
- * ```tsx
86
- * try {
87
- * Taro.removeStorageSync('key')
88
- * } catch (e) {
89
- * // Do something when catch error
90
- * }
91
- * ```
92
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html
93
- */
94
- function removeStorageSync(
95
- /** 本地缓存中指定的 key */
96
- key: string,
97
- ): void
98
-
99
19
  namespace removeStorage {
100
20
  interface Option {
101
21
  /** 本地缓存中指定的 key */
102
22
  key: string
103
23
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
104
- complete?: (res: General.CallbackResult) => void
24
+ complete?: (res: TaroGeneral.CallbackResult) => void
105
25
  /** 接口调用失败的回调函数 */
106
- fail?: (res: General.CallbackResult) => void
26
+ fail?: (res: TaroGeneral.CallbackResult) => void
107
27
  /** 接口调用成功的回调函数 */
108
- success?: (res: General.CallbackResult) => void
28
+ success?: (res: TaroGeneral.CallbackResult) => void
109
29
  }
110
30
  }
111
- /** 从本地缓存中移除指定 key
112
- * @supported weapp, h5, rn
113
- * @example
114
- * ```tsx
115
- * Taro.removeStorage({
116
- * key: 'key',
117
- * success: function (res) {
118
- * console.log(res)
119
- * }
120
- * })
121
- * ```
122
- *
123
- * ```tsx
124
- * try {
125
- * Taro.removeStorageSync('key')
126
- * } catch (e) {
127
- * // Do something when catch error
128
- * }
129
- * ```
130
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html
131
- */
132
- function removeStorage(option: removeStorage.Option): Promise<General.CallbackResult>
133
-
134
- /** Taro.getStorage 的同步版本
135
- * @supported weapp, h5
136
- * @example
137
- * ```tsx
138
- * Taro.getStorage({
139
- * key: 'key',
140
- * success: function (res) {
141
- * console.log(res.data)
142
- * }
143
- * })
144
- * ```
145
- *
146
- * ```tsx
147
- * try {
148
- * var value = Taro.getStorageSync('key')
149
- * if (value) {
150
- * // Do something with return value
151
- * }
152
- * } catch (e) {
153
- * // Do something when catch error
154
- * }
155
- * ```
156
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html
157
- */
158
- function getStorageSync<T = any>(
159
- /** 本地缓存中指定的 key */
160
- key: string,
161
- ): T
162
31
 
163
32
  namespace getStorageInfoSync {
164
33
  interface Option {
@@ -171,39 +40,12 @@ declare namespace Taro {
171
40
  }
172
41
  }
173
42
 
174
- /** Taro.getStorageInfo 的同步版本
175
- * @supported weapp, h5
176
- * @example
177
- * ```tsx
178
- * Taro.getStorageInfo({
179
- * success: function (res) {
180
- * console.log(res.keys)
181
- * console.log(res.currentSize)
182
- * console.log(res.limitSize)
183
- * }
184
- * })
185
- * ```
186
- *
187
- * ```tsx
188
- * try {
189
- * const res = Taro.getStorageInfoSync()
190
- * console.log(res.keys)
191
- * console.log(res.currentSize)
192
- * console.log(res.limitSize)
193
- * } catch (e) {
194
- * // Do something when catch error
195
- * }
196
- * ```
197
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html
198
- */
199
- function getStorageInfoSync(): getStorageInfoSync.Option
200
-
201
43
  namespace getStorageInfo {
202
44
  interface Option {
203
45
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
204
- complete?: (res: General.CallbackResult) => void
46
+ complete?: (res: TaroGeneral.CallbackResult) => void
205
47
  /** 接口调用失败的回调函数 */
206
- fail?: (res: General.CallbackResult) => void
48
+ fail?: (res: TaroGeneral.CallbackResult) => void
207
49
  /** 接口调用成功的回调函数 */
208
50
  success?: (option: SuccessCallbackOption) => void
209
51
  }
@@ -218,45 +60,18 @@ declare namespace Taro {
218
60
  }
219
61
  }
220
62
 
221
- /** 异步获取当前storage的相关信息
222
- * @supported weapp, h5, rn
223
- * @example
224
- * ```tsx
225
- * Taro.getStorageInfo({
226
- * success: function (res) {
227
- * console.log(res.keys)
228
- * console.log(res.currentSize)
229
- * console.log(res.limitSize)
230
- * }
231
- * })
232
- * ```
233
- *
234
- * ```tsx
235
- * try {
236
- * const res = Taro.getStorageInfoSync()
237
- * console.log(res.keys)
238
- * console.log(res.currentSize)
239
- * console.log(res.limitSize)
240
- * } catch (e) {
241
- * // Do something when catch error
242
- * }
243
- * ```
244
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html
245
- */
246
- function getStorageInfo(option?: getStorageInfo.Option): Promise<General.CallbackResult>
247
-
248
63
  namespace getStorage {
249
64
  interface Option<T> {
250
65
  /** 本地缓存中指定的 key */
251
66
  key: string
252
67
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
253
- complete?: (res: General.CallbackResult) => void
68
+ complete?: (res: TaroGeneral.CallbackResult) => void
254
69
  /** 接口调用失败的回调函数 */
255
- fail?: (res: General.CallbackResult) => void
70
+ fail?: (res: TaroGeneral.CallbackResult) => void
256
71
  /** 接口调用成功的回调函数 */
257
72
  success?: (result: SuccessCallbackResult<T>) => void
258
73
  }
259
- interface SuccessCallbackResult<T> extends General.CallbackResult {
74
+ interface SuccessCallbackResult<T> extends TaroGeneral.CallbackResult {
260
75
  /** key对应的内容 */
261
76
  data: T
262
77
  /** 调用结果 */
@@ -264,76 +79,266 @@ declare namespace Taro {
264
79
  }
265
80
  }
266
81
 
267
- /** 从本地缓存中异步获取指定 key 的内容
268
- * @supported weapp, h5, rn
269
- * @example
270
- * ```tsx
271
- * Taro.getStorage({
272
- * key: 'key',
273
- * success: function (res) {
274
- * console.log(res.data)
275
- * }
276
- * })
277
- * ```
278
- *
279
- * ```tsx
280
- * try {
281
- * var value = Taro.getStorageSync('key')
282
- * if (value) {
283
- * // Do something with return value
284
- * }
285
- * } catch (e) {
286
- * // Do something when catch error
287
- * }
288
- * ```
289
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html
290
- */
291
- function getStorage<T = any>(option: getStorage.Option<T>): Promise<getStorage.SuccessCallbackResult<T>>
292
-
293
- /** Taro.clearStorage 的同步版本
294
- * @supported weapp, h5
295
- * @example
296
- * ```tsx
297
- * Taro.clearStorage()
298
- * ```
299
- *
300
- * ```tsx
301
- * try {
302
- * Taro.clearStorageSync()
303
- * } catch(e) {
304
- * // Do something when catch error
305
- * }
306
- * ```
307
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html
308
- */
309
- function clearStorageSync(): void
310
-
311
82
  namespace clearStorage {
312
83
  interface Option {
313
84
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
314
- complete?: (res: General.CallbackResult) => void
85
+ complete?: (res: TaroGeneral.CallbackResult) => void
315
86
  /** 接口调用失败的回调函数 */
316
- fail?: (res: General.CallbackResult) => void
87
+ fail?: (res: TaroGeneral.CallbackResult) => void
317
88
  /** 接口调用成功的回调函数 */
318
- success?: (res: General.CallbackResult) => void
89
+ success?: (res: TaroGeneral.CallbackResult) => void
319
90
  }
320
91
  }
321
92
 
322
- /** 清理本地数据缓存
323
- * @supported weapp, h5, rn
324
- * @example
325
- * ```tsx
326
- * Taro.clearStorage()
327
- * ```
328
- *
329
- * ```tsx
330
- * try {
331
- * Taro.clearStorageSync()
332
- * } catch(e) {
333
- * // Do something when catch error
334
- * }
335
- * ```
336
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html
337
- */
338
- function clearStorage(option?: clearStorage.Option): Promise<General.CallbackResult>
93
+ interface TaroStatic {
94
+ /** Taro.setStorage 的同步版本
95
+ * @supported weapp, h5
96
+ * @example
97
+ * ```tsx
98
+ * Taro.setStorage({
99
+ * key:"key",
100
+ * data:"value"
101
+ * })
102
+ * ```
103
+ * @example
104
+ * ```tsx
105
+ * try {
106
+ * Taro.setStorageSync('key', 'value')
107
+ * } catch (e) { }
108
+ * ```
109
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html
110
+ */
111
+ setStorageSync(
112
+ /** 本地缓存中指定的 key */
113
+ key: string,
114
+ /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
115
+ data: any,
116
+ ): void
117
+
118
+ /** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
119
+ * @supported weapp, h5, rn
120
+ * @example
121
+ * ```tsx
122
+ * Taro.setStorage({
123
+ * key:"key",
124
+ * data:"value"
125
+ * })
126
+ * ```
127
+ * ```tsx
128
+ * try {
129
+ * Taro.setStorageSync('key', 'value')
130
+ * } catch (e) { }
131
+ * ```
132
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html
133
+ */
134
+ setStorage(option: setStorage.Option): Promise<TaroGeneral.CallbackResult>
135
+
136
+ /**
137
+ * 从本地缓存中同步移除指定 key 。
138
+ * @supported weapp, h5
139
+ * @example
140
+ * ```tsx
141
+ * try {
142
+ * Taro.removeStorageSync('key')
143
+ * } catch (e) {
144
+ * // Do something when catch error
145
+ * }
146
+ * ```
147
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html
148
+ */
149
+ removeStorageSync(key: string): void
150
+
151
+ /** Taro.removeStorage 的同步版本
152
+ * @example
153
+ * ```tsx
154
+ * Taro.removeStorage({
155
+ * key: 'key',
156
+ * success: function (res) {
157
+ * console.log(res)
158
+ * }
159
+ * })
160
+ * ```
161
+ *
162
+ * ```tsx
163
+ * try {
164
+ * Taro.removeStorageSync('key')
165
+ * } catch (e) {
166
+ * // Do something when catch error
167
+ * }
168
+ * ```
169
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html
170
+ */
171
+ removeStorageSync(
172
+ /** 本地缓存中指定的 key */
173
+ key: string,
174
+ ): void
175
+
176
+ /** 从本地缓存中移除指定 key
177
+ * @supported weapp, h5, rn
178
+ * @example
179
+ * ```tsx
180
+ * Taro.removeStorage({
181
+ * key: 'key',
182
+ * success: function (res) {
183
+ * console.log(res)
184
+ * }
185
+ * })
186
+ * ```
187
+ *
188
+ * ```tsx
189
+ * try {
190
+ * Taro.removeStorageSync('key')
191
+ * } catch (e) {
192
+ * // Do something when catch error
193
+ * }
194
+ * ```
195
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html
196
+ */
197
+ removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
198
+
199
+ /** Taro.getStorage 的同步版本
200
+ * @supported weapp, h5
201
+ * @example
202
+ * ```tsx
203
+ * Taro.getStorage({
204
+ * key: 'key',
205
+ * success: function (res) {
206
+ * console.log(res.data)
207
+ * }
208
+ * })
209
+ * ```
210
+ *
211
+ * ```tsx
212
+ * try {
213
+ * var value = Taro.getStorageSync('key')
214
+ * if (value) {
215
+ * // Do something with return value
216
+ * }
217
+ * } catch (e) {
218
+ * // Do something when catch error
219
+ * }
220
+ * ```
221
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html
222
+ */
223
+ getStorageSync<T = any>(
224
+ /** 本地缓存中指定的 key */
225
+ key: string,
226
+ ): T
227
+
228
+ /** Taro.getStorageInfo 的同步版本
229
+ * @supported weapp, h5
230
+ * @example
231
+ * ```tsx
232
+ * Taro.getStorageInfo({
233
+ * success: function (res) {
234
+ * console.log(res.keys)
235
+ * console.log(res.currentSize)
236
+ * console.log(res.limitSize)
237
+ * }
238
+ * })
239
+ * ```
240
+ *
241
+ * ```tsx
242
+ * try {
243
+ * const res = Taro.getStorageInfoSync()
244
+ * console.log(res.keys)
245
+ * console.log(res.currentSize)
246
+ * console.log(res.limitSize)
247
+ * } catch (e) {
248
+ * // Do something when catch error
249
+ * }
250
+ * ```
251
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html
252
+ */
253
+ getStorageInfoSync(): getStorageInfoSync.Option
254
+
255
+ /** 异步获取当前storage的相关信息
256
+ * @supported weapp, h5, rn
257
+ * @example
258
+ * ```tsx
259
+ * Taro.getStorageInfo({
260
+ * success: function (res) {
261
+ * console.log(res.keys)
262
+ * console.log(res.currentSize)
263
+ * console.log(res.limitSize)
264
+ * }
265
+ * })
266
+ * ```
267
+ *
268
+ * ```tsx
269
+ * try {
270
+ * const res = Taro.getStorageInfoSync()
271
+ * console.log(res.keys)
272
+ * console.log(res.currentSize)
273
+ * console.log(res.limitSize)
274
+ * } catch (e) {
275
+ * // Do something when catch error
276
+ * }
277
+ * ```
278
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html
279
+ */
280
+ getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
281
+
282
+ /** 从本地缓存中异步获取指定 key 的内容
283
+ * @supported weapp, h5, rn
284
+ * @example
285
+ * ```tsx
286
+ * Taro.getStorage({
287
+ * key: 'key',
288
+ * success: function (res) {
289
+ * console.log(res.data)
290
+ * }
291
+ * })
292
+ * ```
293
+ *
294
+ * ```tsx
295
+ * try {
296
+ * var value = Taro.getStorageSync('key')
297
+ * if (value) {
298
+ * // Do something with return value
299
+ * }
300
+ * } catch (e) {
301
+ * // Do something when catch error
302
+ * }
303
+ * ```
304
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html
305
+ */
306
+ getStorage<T = any>(option: getStorage.Option<T>): Promise<getStorage.SuccessCallbackResult<T>>
307
+
308
+ /** Taro.clearStorage 的同步版本
309
+ * @supported weapp, h5
310
+ * @example
311
+ * ```tsx
312
+ * Taro.clearStorage()
313
+ * ```
314
+ *
315
+ * ```tsx
316
+ * try {
317
+ * Taro.clearStorageSync()
318
+ * } catch(e) {
319
+ * // Do something when catch error
320
+ * }
321
+ * ```
322
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html
323
+ */
324
+ clearStorageSync(): void
325
+
326
+ /** 清理本地数据缓存
327
+ * @supported weapp, h5, rn
328
+ * @example
329
+ * ```tsx
330
+ * Taro.clearStorage()
331
+ * ```
332
+ *
333
+ * ```tsx
334
+ * try {
335
+ * Taro.clearStorageSync()
336
+ * } catch(e) {
337
+ * // Do something when catch error
338
+ * }
339
+ * ```
340
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html
341
+ */
342
+ clearStorage(option?: clearStorage.Option): Promise<TaroGeneral.CallbackResult>
343
+ }
339
344
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace setPageInfo {
3
5
  interface Option {
4
6
  /** 页面标题 */
@@ -51,45 +53,48 @@ declare namespace Taro {
51
53
  sessionDuration?: string
52
54
  }
53
55
  }
54
- /**
55
- * 百度智能小程序可接入百度搜索和百度 App,setPageInfo 负责为小程序设置各类页面基础信息,包括标题、关键字、页面描述以及图片信息、视频信息等。开发者为智能小程序设置完备的页面基础信息,有助于智能小程序在搜索引擎和信息流中得到更加有效的展示和分发。
56
- * @supported swan
57
- * @example
58
- * ```tsx
59
- * Taro.setPageInfo({
60
- * title: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!-百度贴吧',
61
- * keywords: '百度,百度贴吧,好运中国年,60,晒元,宵节',
62
- * description: '晒元宵节活动红包,爱..昨天的百度APP元宵节活动中,共发出2亿现金红包、含151万个手气现金大奖和240辆红旗轿车,谁是好运锦鲤,快来分享!马上惊喜升级~摇中红包的锦鲤们即刻晒出红包金额截图,我们将会抽取660位好运锦鲤',
63
- * articleTitle: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!',
64
- * releaseDate: '2019-01-02 12:01:30',
65
- * image: [
66
- * 'http://c.hiphotos.baidu.com/forum/w%3D480/sign=73c62dda83b1cb133e693d1bed5456da/f33725109313b07e8dee163d02d7912396dd8cfe.jpg',
67
- * 'https://hiphotos.baidu.com/fex/%70%69%63/item/43a7d933c895d143e7b745607ef082025baf07ab.jpg'
68
- * ],
69
- * video: [{
70
- * url: 'https://www.baidu.com/mx/v12.mp4',
71
- * duration: '100',
72
- * image: 'https://smartprogram.baidu.com/docs/img/image-scaleToFill.png'
73
- * }],
74
- * visit: {
75
- * pv: '1000',
76
- * uv: '100',
77
- * sessionDuration: '130'
78
- * },
79
- * likes: '75',
80
- * comments: '13',
81
- * collects: '23',
82
- * shares: '8',
83
- * followers: '35',
84
- * success: res => {
85
- * console.log('setPageInfo success');
86
- * },
87
- * fail: err => {
88
- * console.log('setPageInfo fail', err);
89
- * }
90
- * })
91
- * ```
92
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setPageInfo/
93
- */
94
- function setPageInfo(option: setPageInfo.Option): void
56
+
57
+ interface TaroStatic {
58
+ /**
59
+ * 百度智能小程序可接入百度搜索和百度 App,setPageInfo 负责为小程序设置各类页面基础信息,包括标题、关键字、页面描述以及图片信息、视频信息等。开发者为智能小程序设置完备的页面基础信息,有助于智能小程序在搜索引擎和信息流中得到更加有效的展示和分发。
60
+ * @supported swan
61
+ * @example
62
+ * ```tsx
63
+ * Taro.setPageInfo({
64
+ * title: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!-百度贴吧',
65
+ * keywords: '百度,百度贴吧,好运中国年,60,晒元,宵节',
66
+ * description: '晒元宵节活动红包,爱..昨天的百度APP元宵节活动中,共发出2亿现金红包、含151万个手气现金大奖和240辆红旗轿车,谁是好运锦鲤,快来分享!马上惊喜升级~摇中红包的锦鲤们即刻晒出红包金额截图,我们将会抽取660位好运锦鲤',
67
+ * articleTitle: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!',
68
+ * releaseDate: '2019-01-02 12:01:30',
69
+ * image: [
70
+ * 'http://c.hiphotos.baidu.com/forum/w%3D480/sign=73c62dda83b1cb133e693d1bed5456da/f33725109313b07e8dee163d02d7912396dd8cfe.jpg',
71
+ * 'https://hiphotos.baidu.com/fex/%70%69%63/item/43a7d933c895d143e7b745607ef082025baf07ab.jpg'
72
+ * ],
73
+ * video: [{
74
+ * url: 'https://www.baidu.com/mx/v12.mp4',
75
+ * duration: '100',
76
+ * image: 'https://smartprogram.baidu.com/docs/img/image-scaleToFill.png'
77
+ * }],
78
+ * visit: {
79
+ * pv: '1000',
80
+ * uv: '100',
81
+ * sessionDuration: '130'
82
+ * },
83
+ * likes: '75',
84
+ * comments: '13',
85
+ * collects: '23',
86
+ * shares: '8',
87
+ * followers: '35',
88
+ * success: res => {
89
+ * console.log('setPageInfo success');
90
+ * },
91
+ * fail: err => {
92
+ * console.log('setPageInfo fail', err);
93
+ * }
94
+ * })
95
+ * ```
96
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setPageInfo/
97
+ */
98
+ setPageInfo(option: setPageInfo.Option): void
99
+ }
95
100
  }