react-native-onyx 1.0.123 → 1.0.124
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/dist/web.development.js.map +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/ActiveClientManager/index.native.js +1 -6
- package/lib/ActiveClientManager/index.web.js +3 -8
- package/lib/Onyx.d.ts +3 -3
- package/lib/Onyx.js +7 -7
- package/lib/broadcast/index.native.js +1 -3
- package/lib/broadcast/index.web.js +2 -4
- package/package.json +1 -1
|
@@ -63,14 +63,14 @@ function init() {
|
|
|
63
63
|
}
|
|
64
64
|
activeClientID = message.data.clientID;
|
|
65
65
|
|
|
66
|
-
subscribers.forEach(callback => callback());
|
|
66
|
+
subscribers.forEach((callback) => callback());
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
case REMOVED_LEADER_MESSAGE:
|
|
70
70
|
activeClientID = clientID;
|
|
71
71
|
timestamp = Date.now();
|
|
72
72
|
Broadcast.sendMessage({type: NEW_LEADER_MESSAGE, clientID, timestamp});
|
|
73
|
-
subscribers.forEach(callback => callback());
|
|
73
|
+
subscribers.forEach((callback) => callback());
|
|
74
74
|
break;
|
|
75
75
|
default:
|
|
76
76
|
break;
|
|
@@ -91,9 +91,4 @@ function init() {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
export {
|
|
95
|
-
isClientTheLeader,
|
|
96
|
-
init,
|
|
97
|
-
isReady,
|
|
98
|
-
subscribeToClientChange,
|
|
99
|
-
};
|
|
94
|
+
export {isClientTheLeader, init, isReady, subscribeToClientChange};
|
package/lib/Onyx.d.ts
CHANGED
|
@@ -315,9 +315,9 @@ declare const Onyx: {
|
|
|
315
315
|
METHOD: typeof METHOD;
|
|
316
316
|
setMemoryOnlyKeys: typeof setMemoryOnlyKeys;
|
|
317
317
|
onClear: typeof onClear;
|
|
318
|
-
isClientManagerReady: typeof ActiveClientManager.isReady
|
|
319
|
-
isClientTheLeader: typeof ActiveClientManager.isClientTheLeader
|
|
320
|
-
subscribeToClientChange: typeof ActiveClientManager.subscribeToClientChange
|
|
318
|
+
isClientManagerReady: typeof ActiveClientManager.isReady;
|
|
319
|
+
isClientTheLeader: typeof ActiveClientManager.isClientTheLeader;
|
|
320
|
+
subscribeToClientChange: typeof ActiveClientManager.subscribeToClientChange;
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
export default Onyx;
|
package/lib/Onyx.js
CHANGED
|
@@ -1090,7 +1090,7 @@ function set(key, value) {
|
|
|
1090
1090
|
const {value: valueAfterRemoving, wasRemoved} = removeNullValues(key, value);
|
|
1091
1091
|
|
|
1092
1092
|
if (hasPendingMergeForKey(key)) {
|
|
1093
|
-
delete mergeQueue[key]
|
|
1093
|
+
delete mergeQueue[key];
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
const hasChanged = cache.hasValueChanged(key, valueAfterRemoving);
|
|
@@ -1119,15 +1119,15 @@ function set(key, value) {
|
|
|
1119
1119
|
function prepareKeyValuePairsForStorage(data) {
|
|
1120
1120
|
const keyValuePairs = [];
|
|
1121
1121
|
|
|
1122
|
-
_.forEach(data, (value, key) =>
|
|
1122
|
+
_.forEach(data, (value, key) => {
|
|
1123
1123
|
const {value: valueAfterRemoving, wasRemoved} = removeNullValues(key, value);
|
|
1124
1124
|
|
|
1125
|
-
if (wasRemoved) return
|
|
1125
|
+
if (wasRemoved) return;
|
|
1126
1126
|
|
|
1127
|
-
keyValuePairs.push([key, valueAfterRemoving])
|
|
1127
|
+
keyValuePairs.push([key, valueAfterRemoving]);
|
|
1128
1128
|
});
|
|
1129
1129
|
|
|
1130
|
-
return keyValuePairs
|
|
1130
|
+
return keyValuePairs;
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
1133
|
/**
|
|
@@ -1233,7 +1233,7 @@ function merge(key, changes) {
|
|
|
1233
1233
|
|
|
1234
1234
|
mergeQueuePromise[key] = get(key).then((existingValue) => {
|
|
1235
1235
|
// Calls to Onyx.set after a merge will terminate the current merge process and clear the merge queue
|
|
1236
|
-
if (mergeQueue[key] == null) return
|
|
1236
|
+
if (mergeQueue[key] == null) return;
|
|
1237
1237
|
|
|
1238
1238
|
try {
|
|
1239
1239
|
// We first only merge the changes, so we can provide these to the native implementation (SQLite uses only delta changes in "JSON_PATCH" to merge)
|
|
@@ -1249,7 +1249,7 @@ function merge(key, changes) {
|
|
|
1249
1249
|
delete mergeQueuePromise[key];
|
|
1250
1250
|
|
|
1251
1251
|
// If the batched changes equal null, we want to remove the key from storage, to reduce storage size
|
|
1252
|
-
const {wasRemoved} = removeNullValues(key, batchedChanges)
|
|
1252
|
+
const {wasRemoved} = removeNullValues(key, batchedChanges);
|
|
1253
1253
|
|
|
1254
1254
|
// After that we merge the batched changes with the existing value
|
|
1255
1255
|
// We can remove null values from the "modifiedData", because "null" implicates that the user wants to remove a value from storage.
|
|
@@ -19,7 +19,7 @@ function sendMessage(message) {
|
|
|
19
19
|
function subscribe(callback) {
|
|
20
20
|
subscriptions.push(callback);
|
|
21
21
|
channel.onmessage = (message) => {
|
|
22
|
-
subscriptions.forEach(c => c(message));
|
|
22
|
+
subscriptions.forEach((c) => c(message));
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -30,6 +30,4 @@ function disconnect() {
|
|
|
30
30
|
channel.close();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export {
|
|
34
|
-
sendMessage, subscribe, disconnect,
|
|
35
|
-
};
|
|
33
|
+
export {sendMessage, subscribe, disconnect};
|