valdres 0.2.0-pre.16 → 0.2.0-pre.17
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/index.js +20 -2
- package/dist/types/lib/transaction.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -920,6 +920,24 @@ class Transaction {
|
|
|
920
920
|
}
|
|
921
921
|
return value;
|
|
922
922
|
};
|
|
923
|
+
batchSetFamilyAtoms(family, pairs) {
|
|
924
|
+
if (!this.atomMap.has(family)) {
|
|
925
|
+
this.cloneFamilyIntoTxn(family);
|
|
926
|
+
}
|
|
927
|
+
const index = this.atomMap.get(family).__index;
|
|
928
|
+
for (const [atom, value] of pairs) {
|
|
929
|
+
if (atom.family !== family) {
|
|
930
|
+
throw new Error("Atom does not belong to the provided family");
|
|
931
|
+
}
|
|
932
|
+
index.created.set(atom, performance.now());
|
|
933
|
+
if (index.deleted.has(atom))
|
|
934
|
+
index.deleted.delete(atom);
|
|
935
|
+
this.atomMap.set(atom, value);
|
|
936
|
+
}
|
|
937
|
+
index.rendered = null;
|
|
938
|
+
index.renderedArray = null;
|
|
939
|
+
this.recursivlyUpdateAtomFamilyIndexes(family);
|
|
940
|
+
}
|
|
923
941
|
del = (atom) => {
|
|
924
942
|
if (!this.atomMap.has(atom.family)) {
|
|
925
943
|
this.cloneFamilyIntoTxn(atom.family);
|
|
@@ -1452,9 +1470,9 @@ var isFamilySelector = (state) => isFamilyState(state) && isSelector(state);
|
|
|
1452
1470
|
|
|
1453
1471
|
// src/index.ts
|
|
1454
1472
|
if (globalThis.__valdres__) {
|
|
1455
|
-
throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${"0.2.0-pre.
|
|
1473
|
+
throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${"0.2.0-pre.17"}`);
|
|
1456
1474
|
} else {
|
|
1457
|
-
globalThis.__valdres__ = "0.2.0-pre.
|
|
1475
|
+
globalThis.__valdres__ = "0.2.0-pre.17";
|
|
1458
1476
|
}
|
|
1459
1477
|
export {
|
|
1460
1478
|
store,
|
|
@@ -17,6 +17,7 @@ export declare class Transaction {
|
|
|
17
17
|
private valueFromTxnOrData;
|
|
18
18
|
get: GetValue;
|
|
19
19
|
set: <V>(atom: Atom<V>, value: V | ((currentValue: V) => V)) => V;
|
|
20
|
+
batchSetFamilyAtoms(family: any, pairs: any): void;
|
|
20
21
|
del: (atom: AtomFamilyAtom<any, any>) => void;
|
|
21
22
|
scope: (scopeId: string, callback: (txn: Transaction) => any) => any;
|
|
22
23
|
parentScope: (callback: (txn: Transaction) => any) => any;
|