x-app-sdk 1.1.7 → 1.1.8
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/README.md +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -222,25 +222,25 @@ closeApp({ result: 'success', data: 'some data' });
|
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
### 9. Store - Lưu trữ cục bộ
|
|
225
|
-
#### `saveStore(data)`
|
|
225
|
+
#### `saveStore(key, data)`
|
|
226
226
|
Lưu dữ liệu vào bộ nhớ cục bộ của SuperApp.
|
|
227
227
|
```js
|
|
228
228
|
import { saveStore } from 'x-app-sdk';
|
|
229
229
|
|
|
230
230
|
const data = JSON.stringify({ key: 'value' });
|
|
231
|
-
saveStore(data).then(() => {
|
|
231
|
+
saveStore("key", data).then(() => {
|
|
232
232
|
console.log('Dữ liệu đã được lưu');
|
|
233
233
|
}).catch(error => {
|
|
234
234
|
console.error('Lỗi lưu dữ liệu:', error);
|
|
235
235
|
});
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
#### `getStore()`
|
|
238
|
+
#### `getStore(key)`
|
|
239
239
|
Lấy dữ liệu từ bộ nhớ cục bộ.
|
|
240
240
|
```js
|
|
241
241
|
import { getStore } from 'x-app-sdk';
|
|
242
242
|
|
|
243
|
-
getStore().then(result => {
|
|
243
|
+
getStore("key").then(result => {
|
|
244
244
|
const data = JSON.parse(result.data);
|
|
245
245
|
console.log('Dữ liệu lấy được:', data);
|
|
246
246
|
}).catch(error => {
|
|
@@ -248,12 +248,12 @@ getStore().then(result => {
|
|
|
248
248
|
});
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
#### `clearStore()`
|
|
251
|
+
#### `clearStore(key)`
|
|
252
252
|
Xóa tất cả dữ liệu trong bộ nhớ cục bộ.
|
|
253
253
|
```js
|
|
254
254
|
import { clearStore } from 'x-app-sdk';
|
|
255
255
|
|
|
256
|
-
clearStore().then(() => {
|
|
256
|
+
clearStore("key").then(() => {
|
|
257
257
|
console.log('Dữ liệu đã được xóa');
|
|
258
258
|
}).catch(error => {
|
|
259
259
|
console.error('Lỗi xóa dữ liệu:', error);
|