@figliolia/galena 4.0.1 → 4.0.2
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/package.json +1 -1
- package/src/Galena.ts +8 -2
package/package.json
CHANGED
package/src/Galena.ts
CHANGED
|
@@ -62,6 +62,12 @@ export class Galena<T extends Record<string, State<any>>> extends API<
|
|
|
62
62
|
super(...middleware);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Get State
|
|
67
|
+
*
|
|
68
|
+
* Returns an assembled state object containing each
|
|
69
|
+
* state instance's current value of state
|
|
70
|
+
*/
|
|
65
71
|
public getState() {
|
|
66
72
|
const result = {} as GalenaState<T>;
|
|
67
73
|
for (const key in this.state) {
|
|
@@ -112,7 +118,7 @@ export class Galena<T extends Record<string, State<any>>> extends API<
|
|
|
112
118
|
* changes. To your callback will be provided the `updated` state
|
|
113
119
|
* instance, along with the entire `state` tree
|
|
114
120
|
*/
|
|
115
|
-
public subscribe
|
|
121
|
+
public subscribe(subscriber: AppSubscriber<T>) {
|
|
116
122
|
const ID = this.Emitter.on("change", subscriber);
|
|
117
123
|
const unsubscribers: (() => void)[] = [];
|
|
118
124
|
for (const key in this.state) {
|
|
@@ -132,7 +138,7 @@ export class Galena<T extends Record<string, State<any>>> extends API<
|
|
|
132
138
|
unsubscribers.pop?.()?.();
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
|
-
}
|
|
141
|
+
}
|
|
136
142
|
|
|
137
143
|
/**
|
|
138
144
|
* Register Middleware
|