All Projects → TobiaszCudnik → asyncmachine

TobiaszCudnik / asyncmachine

Licence: other
Relational State Machine with a visual inspector

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to asyncmachine

Pvm
Build workflows, activities, BPMN like processes, or state machines with PVM.
Stars: ✭ 348 (+419.4%)
Mutual labels:  state-management, state-machine
Muster
A universal data layer for components and services
Stars: ✭ 59 (-11.94%)
Mutual labels:  state-management, graphs
Machinery
State machine thin layer for structs (+ GUI for Phoenix apps)
Stars: ✭ 367 (+447.76%)
Mutual labels:  state-management, state-machine
zedux
⚡ A high-level, declarative, composable form of Redux https://bowheart.github.io/zedux/
Stars: ✭ 43 (-35.82%)
Mutual labels:  state-management, state-machine
Use Machine
React Hook for using Statecharts powered by XState. use-machine.
Stars: ✭ 226 (+237.31%)
Mutual labels:  state-management, state-machine
Beedle
A tiny library inspired by Redux & Vuex to help you manage state in your JavaScript apps
Stars: ✭ 329 (+391.04%)
Mutual labels:  state-management, state-machine
React Context Hook
A React.js global state manager with Hooks
Stars: ✭ 50 (-25.37%)
Mutual labels:  state-management, state-machine
useStateMachine
The <1 kb state machine hook for React
Stars: ✭ 2,231 (+3229.85%)
Mutual labels:  state-management, state-machine
State Machine Component
⚙️ State machine -powered components in 250 bytes
Stars: ✭ 178 (+165.67%)
Mutual labels:  state-management, state-machine
Zproc
Process on steroids
Stars: ✭ 112 (+67.16%)
Mutual labels:  state-management, state-machine
statebot
Write more robust and understandable programs. Statebot hopes to make Finite State Machines a little more accessible.
Stars: ✭ 24 (-64.18%)
Mutual labels:  state-management, state-machine
xoid
Framework-agnostic state management library designed for simplicity and scalability ⚛
Stars: ✭ 96 (+43.28%)
Mutual labels:  state-management, state-machine
xstate-cpp-generator
C++ State Machine generator for Xstate
Stars: ✭ 33 (-50.75%)
Mutual labels:  state-management, state-machine
Redux Machine
A tiny library (12 lines) for creating state machines in Redux apps
Stars: ✭ 338 (+404.48%)
Mutual labels:  state-management, state-machine
xstate-viz
Visualizer for XState machines
Stars: ✭ 274 (+308.96%)
Mutual labels:  state-management, state-machine
Little State Machine
📠 React custom hook for persist state management
Stars: ✭ 654 (+876.12%)
Mutual labels:  state-management, state-machine
statebot-sh
Statebot for shell-scripts. Write more robust and understandable programs.
Stars: ✭ 14 (-79.1%)
Mutual labels:  state-management, state-machine
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+11.94%)
Mutual labels:  state-management, state-machine
When Ts
When: recombinant design pattern for state machines based on gene expression with a temporal model
Stars: ✭ 112 (+67.16%)
Mutual labels:  state-management, state-machine
Xstate
State machines and statecharts for the modern web.
Stars: ✭ 18,300 (+27213.43%)
Mutual labels:  state-management, state-machine

AsyncMachine is a relational state machine (dependency graph) for a declarative flow control.

Usages:

  • state management
  • parallel tasks
  • loose coupling
  • resource allocation / disposal
  • exception handling
  • fault tolerance
  • method cancellation

It can be used as a single state machine, or a network composed of many. Gzipped code is 7.5kb.

Install

npm i asyncmachine

Documentation

Components:

Features:

Examples

Dry Wet

This basic examples makes use of: states, transitions, relations and synchronous mutations.

import { machine } from 'asyncmachine'
// define
const state = {
  // state Wet when activated, requires state Water to be active
  Wet: {
    require: ['Water']
  },
  // state Dry when activated, will drop (de-activate) state Wet
  Dry: {
    drop: ['Wet']
  },
  // state Water when activated, will add (activate) state Wet and
  // drop (de-activate) state Dry
  Water: {
    add: ['Wet'],
    drop: ['Dry']
  }
}
// initialize
const example = machine(state)
// initially the machine has no active states
example.is() // -> []
// activate state Dry
example.add('Dry')
example.is() // -> [ 'Dry' ]
// activate state Water, which will resolve the relations:
// 1. Water activates Wet
// 2. Wet requires Water
// 3. Dry de-activates Wet
// 4. Water de-activates Dry
// 5. Water activates Wet
example.add('Water')
example.is() // -> [ 'Wet', 'Water' ]

example

Negotiation

Presents how the state negotiation works.

Async Dialog

Presents the following concepts: automatic states, synchronous mutations, delayed mutations and loose coupling.

Exception State

A simple fault tolerance (retrying) using the Exception state.

Piping

Shows how pipes forward states between machines.

Transitions

Shows various types of transition handlers and the way params get passed to them.

TodoMVC and React

Classic TodoMCV example using AsyncMachine as the controller and React as the view.

State streams with RxJS

Observe state changes and navigate through specific paths with RxJS, then feed the result back as a state.

  • Comming soon!

Restaurant

A complex example showing how to solve the producer / consumer problem using AsyncMachine.

inspector view

TaskBot

For a real world example check TaskBot - a real-time sync engine for Google APIs.

Preview

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].