valdres 0.2.0-alpha.51 → 0.2.0-alpha.53
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
CHANGED
|
@@ -491,12 +491,12 @@ var subscribe = (state, callback, requireDeepEqualCheckBeforeCallback, data) =>
|
|
|
491
491
|
if ("parent" in data && (!data.values.has(state) && isAtom(state) || isAtomFamily(state))) {
|
|
492
492
|
const originalCallback = callback;
|
|
493
493
|
parentUnsubscribe = subscribe(state, originalCallback, requireDeepEqualCheckBeforeCallback, data.parent);
|
|
494
|
-
callback = () => {
|
|
494
|
+
callback = (arg) => {
|
|
495
495
|
if (parentUnsubscribe) {
|
|
496
496
|
parentUnsubscribe();
|
|
497
497
|
parentUnsubscribe = undefined;
|
|
498
498
|
}
|
|
499
|
-
originalCallback();
|
|
499
|
+
originalCallback(arg);
|
|
500
500
|
};
|
|
501
501
|
} else if (!data.values.has(state) && isAtom(state)) {
|
|
502
502
|
initAtom(state, data);
|
|
@@ -694,7 +694,8 @@ var transaction = (callback, data, autoCommit = true) => {
|
|
|
694
694
|
} else {
|
|
695
695
|
throw new Error(`Scope '${scopeId}' not found. Registered scopes: ${Object.keys(data.scopes).join(", ")}`);
|
|
696
696
|
}
|
|
697
|
-
}
|
|
697
|
+
},
|
|
698
|
+
data
|
|
698
699
|
});
|
|
699
700
|
if (autoCommit)
|
|
700
701
|
commit();
|
|
@@ -769,7 +770,7 @@ var store = (id) => {
|
|
|
769
770
|
return storeFromStoreData(data);
|
|
770
771
|
};
|
|
771
772
|
// package.json
|
|
772
|
-
var version = "0.2.0-alpha.
|
|
773
|
+
var version = "0.2.0-alpha.52";
|
|
773
774
|
|
|
774
775
|
// src/globalStore.ts
|
|
775
776
|
if (globalThis.__valdres__) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Family } from "../types/Family";
|
|
2
2
|
import type { State } from "../types/State";
|
|
3
3
|
import type { StoreData } from "../types/StoreData";
|
|
4
|
-
export declare const subscribe: <V>(state: State<V> | Family<V>, callback: () => void, requireDeepEqualCheckBeforeCallback: boolean, data: StoreData) => () => void;
|
|
4
|
+
export declare const subscribe: <V>(state: State<V> | Family<V>, callback: (arg?: any) => void, requireDeepEqualCheckBeforeCallback: boolean, data: StoreData) => () => void;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Atom } from "./Atom";
|
|
2
|
+
import type { Family } from "./Family";
|
|
3
|
+
import type { Selector } from "./Selector";
|
|
4
|
+
type UnsuscribeFn = () => void;
|
|
5
|
+
export type SubscribeFn = {
|
|
6
|
+
<V, K>(state: Family<K, V>, callback: (arg: K) => void, requireDeepEqualCheckBeforeCallback?: boolean): UnsuscribeFn;
|
|
7
|
+
<V>(state: Atom<V> | Selector<V>, callback: () => void, requireDeepEqualCheckBeforeCallback?: boolean): UnsuscribeFn;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GetValue } from "./GetValue";
|
|
2
2
|
import type { ResetAtom } from "./ResetAtom";
|
|
3
3
|
import type { SetAtom } from "./SetAtom";
|
|
4
|
+
import type { StoreData } from "./StoreData";
|
|
4
5
|
import type { TransactionFn } from "./TransactionFn";
|
|
5
6
|
export type TransactionInterface = {
|
|
6
7
|
set: SetAtom;
|
|
@@ -8,4 +9,5 @@ export type TransactionInterface = {
|
|
|
8
9
|
reset: ResetAtom;
|
|
9
10
|
commit: () => void;
|
|
10
11
|
scope: <Callback extends TransactionFn>(scopeId: string, callback: Callback) => ReturnType<Callback>;
|
|
12
|
+
data: StoreData;
|
|
11
13
|
};
|
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.53",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Eigil Sagafos"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"access": "public",
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "97fd43c4334c52ccef7a4e0aa8e68b7844ef05d6"
|
|
40
40
|
}
|