react-native-onyx 1.0.22 → 1.0.24
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 +0 -1
- package/dist/web.development.js +4 -14
- 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 +1 -4
- package/lib/storage/WebStorage.js +2 -9
- package/lib/storage/index.native.js +2 -7
- package/package.json +1 -1
package/API.md
CHANGED
|
@@ -256,7 +256,6 @@ Initialize the store with actions and listening for storage events
|
|
|
256
256
|
| [options.maxCachedKeysCount] | <code>Number</code> | <code>55</code> | Sets how many recent keys should we try to keep in cache Setting this to 0 would practically mean no cache We try to free cache when we connect to a safe eviction key |
|
|
257
257
|
| [options.captureMetrics] | <code>Boolean</code> | | Enables Onyx benchmarking and exposes the get/print/reset functions |
|
|
258
258
|
| [options.shouldSyncMultipleInstances] | <code>Boolean</code> | | Auto synchronize storage events between multiple instances of Onyx running in different tabs/windows. Defaults to true for platforms that support local storage (web/desktop) |
|
|
259
|
-
| [option.keysToDisableSyncEvents] | <code>Array.<String></code> | <code>[]</code> | Contains keys for which we want to disable sync event across tabs. |
|
|
260
259
|
| [options.debugSetState] | <code>Boolean</code> | | Enables debugging setState() calls to connected components. |
|
|
261
260
|
|
|
262
261
|
**Example**
|
package/dist/web.development.js
CHANGED
|
@@ -1515,8 +1515,6 @@ function update(data) {
|
|
|
1515
1515
|
* @param {Boolean} [options.captureMetrics] Enables Onyx benchmarking and exposes the get/print/reset functions
|
|
1516
1516
|
* @param {Boolean} [options.shouldSyncMultipleInstances] Auto synchronize storage events between multiple instances
|
|
1517
1517
|
* of Onyx running in different tabs/windows. Defaults to true for platforms that support local storage (web/desktop)
|
|
1518
|
-
* @param {String[]} [option.keysToDisableSyncEvents=[]] Contains keys for which
|
|
1519
|
-
* we want to disable sync event across tabs.
|
|
1520
1518
|
* @param {Boolean} [options.debugSetState] Enables debugging setState() calls to connected components.
|
|
1521
1519
|
* @example
|
|
1522
1520
|
* Onyx.init({
|
|
@@ -1534,8 +1532,7 @@ function init()
|
|
|
1534
1532
|
|
|
1535
1533
|
|
|
1536
1534
|
|
|
1537
|
-
|
|
1538
|
-
{var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref7$keys = _ref7.keys,keys = _ref7$keys === void 0 ? {} : _ref7$keys,_ref7$initialKeyState = _ref7.initialKeyStates,initialKeyStates = _ref7$initialKeyState === void 0 ? {} : _ref7$initialKeyState,_ref7$safeEvictionKey = _ref7.safeEvictionKeys,safeEvictionKeys = _ref7$safeEvictionKey === void 0 ? [] : _ref7$safeEvictionKey,_ref7$maxCachedKeysCo = _ref7.maxCachedKeysCount,maxCachedKeysCount = _ref7$maxCachedKeysCo === void 0 ? 1000 : _ref7$maxCachedKeysCo,_ref7$captureMetrics = _ref7.captureMetrics,captureMetrics = _ref7$captureMetrics === void 0 ? false : _ref7$captureMetrics,_ref7$shouldSyncMulti = _ref7.shouldSyncMultipleInstances,shouldSyncMultipleInstances = _ref7$shouldSyncMulti === void 0 ? Boolean(__webpack_require__.g.localStorage) : _ref7$shouldSyncMulti,_ref7$keysToDisableSy = _ref7.keysToDisableSyncEvents,keysToDisableSyncEvents = _ref7$keysToDisableSy === void 0 ? [] : _ref7$keysToDisableSy,_ref7$debugSetState = _ref7.debugSetState,debugSetState = _ref7$debugSetState === void 0 ? false : _ref7$debugSetState;
|
|
1535
|
+
{var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref7$keys = _ref7.keys,keys = _ref7$keys === void 0 ? {} : _ref7$keys,_ref7$initialKeyState = _ref7.initialKeyStates,initialKeyStates = _ref7$initialKeyState === void 0 ? {} : _ref7$initialKeyState,_ref7$safeEvictionKey = _ref7.safeEvictionKeys,safeEvictionKeys = _ref7$safeEvictionKey === void 0 ? [] : _ref7$safeEvictionKey,_ref7$maxCachedKeysCo = _ref7.maxCachedKeysCount,maxCachedKeysCount = _ref7$maxCachedKeysCo === void 0 ? 1000 : _ref7$maxCachedKeysCo,_ref7$captureMetrics = _ref7.captureMetrics,captureMetrics = _ref7$captureMetrics === void 0 ? false : _ref7$captureMetrics,_ref7$shouldSyncMulti = _ref7.shouldSyncMultipleInstances,shouldSyncMultipleInstances = _ref7$shouldSyncMulti === void 0 ? Boolean(__webpack_require__.g.localStorage) : _ref7$shouldSyncMulti,_ref7$debugSetState = _ref7.debugSetState,debugSetState = _ref7$debugSetState === void 0 ? false : _ref7$debugSetState;
|
|
1539
1536
|
if (captureMetrics) {
|
|
1540
1537
|
// The code here is only bundled and applied when the captureMetrics is set
|
|
1541
1538
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -1567,7 +1564,7 @@ function init()
|
|
|
1567
1564
|
then(deferredInitTask.resolve);
|
|
1568
1565
|
|
|
1569
1566
|
if (shouldSyncMultipleInstances && _underscore.default.isFunction(_storage.default.keepInstancesSync)) {
|
|
1570
|
-
_storage.default.keepInstancesSync(
|
|
1567
|
+
_storage.default.keepInstancesSync(function (key, value) {
|
|
1571
1568
|
_OnyxCache.default.set(key, value);
|
|
1572
1569
|
keyChanged(key, value);
|
|
1573
1570
|
});
|
|
@@ -2119,12 +2116,9 @@ var webStorage = (0, _extends2.default)({},
|
|
|
2119
2116
|
_LocalForage.default, {
|
|
2120
2117
|
|
|
2121
2118
|
/**
|
|
2122
|
-
*
|
|
2123
|
-
* @param {String[]} keysToDisableSyncEvents
|
|
2124
|
-
* Storage synchronization mechanism keeping all opened tabs in sync
|
|
2125
|
-
* @param {function(key: String, data: *)} onStorageKeyChanged
|
|
2119
|
+
* @param {Function} onStorageKeyChanged Storage synchronization mechanism keeping all opened tabs in sync
|
|
2126
2120
|
*/
|
|
2127
|
-
keepInstancesSync: function keepInstancesSync(
|
|
2121
|
+
keepInstancesSync: function keepInstancesSync(onStorageKeyChanged) {var _this = this;
|
|
2128
2122
|
// Override set, remove and clear to raise storage events that we intercept in other tabs
|
|
2129
2123
|
this.setItem = function (key, value) {return _LocalForage.default.setItem(key, value).
|
|
2130
2124
|
then(function () {return raiseStorageSyncEvent(key);});};
|
|
@@ -2146,10 +2140,6 @@ _LocalForage.default, {
|
|
|
2146
2140
|
}
|
|
2147
2141
|
|
|
2148
2142
|
var onyxKey = event.newValue;
|
|
2149
|
-
if (_underscore.default.contains(keysToDisableSyncEvents, onyxKey)) {
|
|
2150
|
-
return;
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
2143
|
_LocalForage.default.getItem(onyxKey).
|
|
2154
2144
|
then(function (value) {return onStorageKeyChanged(onyxKey, value);});
|
|
2155
2145
|
});
|