File tree Expand file tree Collapse file tree 3 files changed +69
-2
lines changed Expand file tree Collapse file tree 3 files changed +69
-2
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,7 @@ $ yarn start
2828
2929Let me know about any issue found or feedback you have at [ Async-Storage issue page] ( https://github.com/react-native-community/async-storage/issues ) .
3030Please mark it as ` examples ` label.
31+
32+ ## License
33+
34+ MIT
Original file line number Diff line number Diff line change 11# Async Storage Core
22
3- Public-facing API of Async Storage.
3+ Main, public-facing components of Async Storage. The core module contains a factory to create an ` AsyncStorage ` instance
4+ and ` IStorageBackend ` , that needs to be implemented by any Backend Storage in order to be compatible.
45
56## Install
67
@@ -82,6 +83,35 @@ const storageBackend = new StorageBackend();
8283const storage = ASFactory.create<StorageModel>(storageBackend);
8384
8485` ` `
86+
87+
88+ ### ` IStorageBackend `
89+
90+ In order to let `AsyncStorage` use a storage backend, it has to implement this interface.
91+ Contains basic set method of methods to get, set and remove data, return already used keys or drop the whole storage.
92+
93+
94+ ` ` ` typescript
95+
96+ import {
97+ IStorageBackend ,
98+ } from ' @react-native-community/async-storage' ;
99+
100+ type Model = {
101+ count: number
102+ user: {
103+ name: string ,
104+ rating: number
105+ }
106+ }
107+
108+ class MyStorageSolution implements IStorageBackend <Model > {
109+ // implement necessary methods
110+ }
111+
112+ ```
113+
114+
85115
86116## License
87117
Original file line number Diff line number Diff line change 11# Storage Backend: Legacy
22
3- todo
3+ An ` AsyncStorage ` storage backend, fully compatible with former version.
4+
5+ ## Installation
6+
7+
8+ // todo: check naming before relase
9+ ``` bash
10+ $ yarn add @react-native-community/async-storage-legacy
11+ ```
12+
13+
14+ ## Usage
15+
16+
17+ ``` typescript
18+
19+ import LegacyStorage from ' @react-native-community/async-storage-legacy' ;
20+ import AsyncStorageFactory from ' @react-native-community/async-storage' ;
21+
22+ type MyModel = {
23+ // ...your storage model
24+ }
25+
26+ const legacyStorage = new LegacyStorage ();
27+
28+ const storage = AsyncStorageFactory .create <MyModel >(legacyStorage );
29+
30+ // ready to use
31+ export default storage ;
32+ ```
33+
34+ ## License
35+
36+ MIT
You can’t perform that action at this time.
0 commit comments