Awai
Promised state management library with a unique events system, where every event is thennable, which allows to write logic in a saga-like way using async functions
Install / Use
/learn @yuriyyakym/AwaiREADME
<div align="center">
<h1 align="center">Awai</h1>
<img width="64px" src="https://github.com/yuriyyakym/awai/blob/master/logo.svg" />
<p style="margin-right: -20px;">Dependency-free state management library</p>
<div>
<img src="https://github.com/yuriyyakym/awai/actions/workflows/tests.yml/badge.svg" />
<img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/yuriyyakym/ba8810278ef57a8ae9243e3edf9f43b8/raw/coverage-master.json" />
<img src="https://img.shields.io/badge/Stability-experimental-blue.svg" />
<img src="https://img.shields.io/badge/License-MIT-blue.svg" />
</div>
<br />
<p>| <a href="https://awai.js.org">Documentation</a> | <a href="https://awai.js.org/examples">Examples</a> | <a href="https://www.npmjs.com/package/awai">NPM</a> | <a href="https://github.com/yuriyyakym/awai-react">Awai-React</a> |</p>
</div>
About
This library introduces a fresh approach to state management, where every event is a thennable (promise-like) with no terminal state.
Awai provides variety of tools helping with organizing asynchronous logic, handling race conditions, and prioritizes the extraction of business logic from the UI layer.
Installation
npm install awai
Documentation
- Quick start
- Architecture
- Examples
- Tools:
- State - simple node which stores data
- AsyncState - helps with storing data loaded asynchronously protecting against race conditions
- Selector - combines multiple states into a single value. Handles async loading and protects against race conditions
- Action - function wrapper which emits events; is helpful for controlling scenarios
- Scenario - composable event listener which allows to declaratively write logic in a saga-like way using async functions
- FamilyState - aggregator of multiple states of the same type; handles both sync and async states
- Effect - runs callback on dependency states change and cleans up previous effects
- Other
