@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Galena.ts +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@figliolia/galena",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "A performant state management library supporting middleware and a rich developer API",
5
5
  "keywords": [
6
6
  "flux",
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 = (subscriber: AppSubscriber<T>) => {
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