react-native-onyx 1.0.16 → 1.0.18
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/API.md +12 -0
- package/README.md +2 -2
- package/dist/web.development.js +231 -141
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/Onyx.js +207 -109
- package/lib/OnyxCache.js +2 -3
- package/lib/{customizerForMergeWith.js → mergeWithCustomized.js} +8 -3
- package/lib/storage/providers/LocalForage.js +2 -3
- package/package.json +1 -1
package/API.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
## Functions
|
|
6
6
|
|
|
7
7
|
<dl>
|
|
8
|
+
<dt><a href="#isCollectionMemberKey">isCollectionMemberKey(collectionKey, key)</a> ⇒ <code>Boolean</code></dt>
|
|
9
|
+
<dd></dd>
|
|
8
10
|
<dt><a href="#connect">connect(mapping)</a> ⇒ <code>Number</code></dt>
|
|
9
11
|
<dd><p>Subscribes a react component's state directly to a store key</p>
|
|
10
12
|
</dd>
|
|
@@ -60,6 +62,16 @@ value will be saved to storage after the default value.</p>
|
|
|
60
62
|
</dd>
|
|
61
63
|
</dl>
|
|
62
64
|
|
|
65
|
+
<a name="isCollectionMemberKey"></a>
|
|
66
|
+
|
|
67
|
+
## isCollectionMemberKey(collectionKey, key) ⇒ <code>Boolean</code>
|
|
68
|
+
**Kind**: global function
|
|
69
|
+
|
|
70
|
+
| Param | Type |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| collectionKey | <code>String</code> |
|
|
73
|
+
| key | <code>String</code> |
|
|
74
|
+
|
|
63
75
|
<a name="connect"></a>
|
|
64
76
|
|
|
65
77
|
## connect(mapping) ⇒ <code>Number</code>
|
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ The data will then be cached and stored via [`AsyncStorage`](https://github.com/
|
|
|
63
63
|
|
|
64
64
|
We can also use `Onyx.merge()` to merge new `Object` or `Array` data in with existing data.
|
|
65
65
|
|
|
66
|
-
For `Array` the default behavior is to
|
|
66
|
+
For `Array` the default behavior is to replace it fully, effectively making it equivalent to set:
|
|
67
67
|
|
|
68
68
|
```javascript
|
|
69
69
|
Onyx.merge(ONYXKEYS.EMPLOYEE_LIST, ['Joe']); // -> ['Joe']
|
|
@@ -77,7 +77,7 @@ Onyx.merge(ONYXKEYS.POLICY, {id: 1}); // -> {id: 1}
|
|
|
77
77
|
Onyx.merge(ONYXKEYS.POLICY, {name: 'My Workspace'}); // -> {id: 1, name: 'My Workspace'}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Arrays inside objects will
|
|
80
|
+
Arrays inside objects will be replaced fully, same as arrays not inside objects:
|
|
81
81
|
|
|
82
82
|
```javascript
|
|
83
83
|
Onyx.merge(ONYXKEYS.POLICY, {employeeList: ['Joe', 'Jack']}); // -> {employeeList: ['Joe', 'Jack']}
|