Repository navigation
Releases
v1.0.0
Release Summary: Store v1.0 - Async Action Support
We are excited to announce the release of Store v1.0, which includes robust support for asynchronous actions, enhancing the flexibility and power of state management in your applications.
Key Features:
Async Action Support:
The Store class now supports asynchronous actions, allowing you to perform async operations (e.g., API calls) seamlessly within your state management logic.
Asynchronous actions can be defined using async functions, enabling straightforward handling of complex state changes that depend on external data or processes.
Type Safety:
Our implementation ensures type safety, maintaining strong TypeScript support for both synchronous and asynchronous actions.
Type definitions (IStoreConfigs, TAction, TSubscriber, TMiddleware) have been updated to accommodate async actions without compromising on type safety.
Middleware Integration:
Middleware continues to operate seamlessly with async actions, allowing you to intercept, modify, or log actions as needed.
The middleware chain correctly handles asynchronous operations, ensuring that your middleware logic remains consistent and reliable.
Subscriber Notifications:
Subscribers are notified of state changes triggered by async actions, ensuring that your UI and other dependent components are always in sync with the latest state.
The notify method ensures subscribers receive updates once the async action completes and the state is updated.
Backward Compatibility:
Existing synchronous actions and their dispatch mechanisms continue to work without any modifications, ensuring a smooth transition to v1
v0.3.0
- Created
MiddlewareManagerclass for managing middlewares and applying middlewares.- Every middleware are unique, which mean there won't be any duplicated middleware even though the user inserted multiple duplicate middlewares.
- Middleware should return next, if not then the chain will be broken and cannot finish.
- Refactor apply from recursive to loop.
Storechecks middleware chain status before invoked. If chain failed then action won't be invoked.- Created
NextFunctiontype - Updated README.md
- Fixed
applyto not only check forundefinedbut alsofalsy - Created test cases for
MiddlewareManager - Created
TMiddlewarefor the base type of creating and applying middleware Storeaccepts middlewares as optional configuration.
v0.2.0
- Created new
CombineStoresclass for combining multiple individual stores to have a single source of truth.- User can then select which store they want to interact with via
getStore - TypeSafety to ensure users don't interact with a non-existent store.
- User can then select which store they want to interact with via
- Upgraded TypeScript to v5.5.2.
- Improved
dispatchsecond parameter type using tuples.- The second parameter now depends fully on the actions. If the action has payload and the user is dispatching that action, then it will ask for a second parameter and vice versa.
- Updated store test cases.
- Created test cases for
CombineStores. - Update some
package.jsonproperties
v0.1.1
v0.1.0
- Created
Storeclass to hold the states and actions- Users can further interact with the store via methods that are provided by the
Storeitselfdispatchmethod to dispatch actionsgetto get all properties of statesubscribewhen there is a change, the subscriber will be notifiedunsubscribeto unsubscribe and will no longer receive notification
- Users can further interact with the store via methods that are provided by the
- Write test cases for
Store