valdres 0.2.0-alpha.12 → 0.2.0-alpha.14
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 +5 -1
- package/dist/src/atom.d.ts +0 -1
- package/dist/src/lib/globalAtom.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -265,7 +265,7 @@ var setAtom = (atom, newValue, data, skipOnSet = false) => {
|
|
|
265
265
|
propagateUpdatedAtoms([atom], data);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
// src/
|
|
268
|
+
// src/lib/globalAtom.ts
|
|
269
269
|
var globalAtom = (defaultValue, options) => {
|
|
270
270
|
const stores = new Set;
|
|
271
271
|
let value = defaultValue;
|
|
@@ -291,6 +291,8 @@ var globalAtom = (defaultValue, options) => {
|
|
|
291
291
|
};
|
|
292
292
|
return newAtom;
|
|
293
293
|
};
|
|
294
|
+
|
|
295
|
+
// src/atom.ts
|
|
294
296
|
var atom = (defaultValue, options) => {
|
|
295
297
|
if (!options)
|
|
296
298
|
return { defaultValue };
|
|
@@ -527,6 +529,8 @@ var setAtoms = (pairs, data) => {
|
|
|
527
529
|
const currentValue = getState(atom2, data);
|
|
528
530
|
if (!equal5(currentValue, value)) {
|
|
529
531
|
updatedAtoms.push(atom2);
|
|
532
|
+
if (atom2.onSet)
|
|
533
|
+
atom2.onSet(value, data);
|
|
530
534
|
data.values.set(atom2, value);
|
|
531
535
|
}
|
|
532
536
|
}
|
package/dist/src/atom.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Atom } from "./types/Atom";
|
|
2
2
|
import type { AtomOptions } from "./types/AtomOptions";
|
|
3
3
|
import type { Selector } from "./types/Selector";
|
|
4
|
-
export declare const globalAtom: <Value = any, FamilyKey = undefined>(defaultValue: Value | (() => Value | Promise<Value>), options: AtomOptions<Value>) => Atom<Value>;
|
|
5
4
|
export declare const atom: <Value = any, FamilyKey = undefined>(defaultValue?: Value | (() => Value | Promise<Value>) | Selector<Value>, options?: AtomOptions<Value>) => Atom<Value, FamilyKey>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Atom } from "./../types/Atom";
|
|
2
|
+
import type { AtomOptions } from "./../types/AtomOptions";
|
|
3
|
+
export declare const globalAtom: <Value = any, FamilyKey = undefined>(defaultValue: Value | (() => Value | Promise<Value>), options: AtomOptions<Value>) => Atom<Value>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valdres",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eigil Sagafos"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"access": "public",
|
|
40
40
|
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2a0e8feb476402603356206cb15d6e894dcecf81"
|
|
43
43
|
}
|