@tarojs/taro 3.3.12 → 3.3.16
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/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +80 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +32 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +171 -122
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/compile.d.ts +1 -5
- package/types/global.d.ts +392 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +46 -75
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
|
|
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:
|
|
11
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
34
12
|
/** 接口调用失败的回调函数 */
|
|
35
|
-
fail?: (res:
|
|
13
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
36
14
|
/** 接口调用成功的回调函数 */
|
|
37
|
-
success?: (res:
|
|
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:
|
|
24
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
105
25
|
/** 接口调用失败的回调函数 */
|
|
106
|
-
fail?: (res:
|
|
26
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
107
27
|
/** 接口调用成功的回调函数 */
|
|
108
|
-
success?: (res:
|
|
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:
|
|
46
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
205
47
|
/** 接口调用失败的回调函数 */
|
|
206
|
-
fail?: (res:
|
|
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:
|
|
68
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
254
69
|
/** 接口调用失败的回调函数 */
|
|
255
|
-
fail?: (res:
|
|
70
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
256
71
|
/** 接口调用成功的回调函数 */
|
|
257
72
|
success?: (result: SuccessCallbackResult<T>) => void
|
|
258
73
|
}
|
|
259
|
-
interface SuccessCallbackResult<T> extends
|
|
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:
|
|
85
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
315
86
|
/** 接口调用失败的回调函数 */
|
|
316
|
-
fail?: (res:
|
|
87
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
317
88
|
/** 接口调用成功的回调函数 */
|
|
318
|
-
success?: (res:
|
|
89
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
319
90
|
}
|
|
320
91
|
}
|
|
321
92
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
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
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
}
|