realar-project / realar

5 kB Advanced state manager for React
MIT License
45 stars 0 forks source link

very low: state machine impl #53

Closed betula closed 3 years ago

betula commented 3 years ago

This abstraction is necessary for the implementation of serial operations. Reactions on each section of the serial operations.


const m = machine()
  .step(a, () => {})
  .step(b, () => 0)
  .step(machine.oneOf()
    .select(a, () => {})
    .select(b)
    .select(c), () => {})
  .loop();

But I think the yield generator function is an interesting way of decision.


loop(function *() {
  yield a;
  yield b;
  yield loop.oneOf([a, b, c]) // or loop.oneOf().select(a, () => {}).select(b, () => {})... chain function
  yield loop.race([a, b, c])
  yield loop.all([a, b, c])

  // Promise namespace operations for suggest
});
betula commented 3 years ago

Added to "the stream of conciseness 0.7+ roadmap"