@figliolia/galena 2.2.1 → 2.2.3

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/README.md CHANGED
@@ -107,7 +107,7 @@ const subscription = FeatureState.subscribe((state) => {
107
107
 
108
108
  FeatureState.update((state) => {
109
109
  // Update feature state!
110
- state.list.push(state.list.length);
110
+ state.list = [...state.list, state.list.length];
111
111
  });
112
112
 
113
113
  // Clean up subscriptions
@@ -393,7 +393,7 @@ In the example below, we'll create a unit of state holding unique identifiers fo
393
393
 
394
394
  ```typescript
395
395
  export const CurrentUserState = AppState.composeState("currentUser", {
396
- userID: 1,
396
+ userID: "1",
397
397
  username: "currentUser",
398
398
  connectedUsers: ["2", "3", "4", "5"]
399
399
  });
@@ -470,9 +470,17 @@ export class UserModel extends State<{
470
470
  username: string;
471
471
  connectedUsers: string[];
472
472
  }> {
473
+ constructor() {
474
+ super("User State", {
475
+ userID: "",
476
+ username: "",
477
+ connectedUsers: []
478
+ })
479
+ }
480
+
473
481
  public addConnection(userID: string) {
474
482
  this.update(state => {
475
- state.connectedUsers.push(userID);
483
+ state.connectedUsers = [...state.connectedUsers, userID];
476
484
  });
477
485
  }
478
486
 
@@ -537,7 +545,7 @@ Using 2 identical applications, I've profiled the performance of Galena vs. Redu
537
545
  As the application scales with more state updates and connected components, the spread between `Galena` and Redux grows even further. Although I don't believe most applications will ever require 10,000 immediate state updates (unless building a game-like experience), `Galena` does relieve the bottle-necks of popular state management utilities quite well.
538
546
 
539
547
  ### Support for Frontend Frameworks!
540
- `Galena` provides bindings for React through [react-galena](https://github.com/alexfigliolia/react-galena). This package provides factories for generating HOC's and hooks from your Galena instances and units of State!
548
+ `Galena` provides bindings for React through [react-galena](https://www.npmjs.com/package/@figliolia/react-galena). This package provides factories for generating HOC's and hooks from your Galena instances and units of State!
541
549
 
542
550
  #### Demo Application
543
551
  To see some basic usage using Galena with React, please check out this [Example App](https://github.com/alexfigliolia/galena-quick-start)
@@ -57,7 +57,7 @@ import { Scheduler } from "./Scheduler";
57
57
  * ```
58
58
  */
59
59
  export declare class State<T extends any = any> extends Scheduler {
60
- private state;
60
+ state: T;
61
61
  readonly name: string;
62
62
  readonly initialState: T;
63
63
  private readonly middleware;
@@ -23,7 +23,7 @@ class Logger extends Middleware_1.Middleware {
23
23
  this.previousState = null;
24
24
  }
25
25
  onBeforeUpdate(state) {
26
- this.previousState = State_1.State.clone(state.getState());
26
+ this.previousState = State_1.State.clone(state.state);
27
27
  }
28
28
  onUpdate(state) {
29
29
  console.log("%cMutation:", "color: rgb(187, 186, 186); font-weight: bold", state.name, "@", this.time);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@figliolia/galena",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "A performant state management library supporting mutable state, batched updates, middleware and a rich development API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",