Robot

一个函数式、不可变的有限状态机库。『🤖 A functional, immutable Finite State Machine library』

  • Owner: matthewp/robot
  • Platform: Web browsers,Linux,Mac,Windows
  • License:: BSD 2-Clause "Simplified" License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Robot

A small functional and immutable Finite State Machine library. Using state machines for your components brings the declarative programming approach to application state.

See thisrobot.life for the main documentation.

import { createMachine, interpret, state, transition } from 'robot3';

let machine = createMachine({
  off: state(
    transition('toggle', 'on')
  ),
  on: state(
    transition('toggle', 'off')
  )
});

const service = interpret(machine, () => {
  render();
});

📚 Documentation

Testing

Tests are located in the test/ folder. Load test/test.html in your browser of choice with any HTTP server you like (I use http-server). Tests are written in QUnit and are simple to understand.

Integrations

Robot works with a variety of UI libraries, and includes integrations for React, Preact, Haunted, and more. See the integrations page to learn more.

License

BSD-2-Clause

Main metrics

Overview
Name With Ownermatthewp/robot
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 3)
Platform
License:BSD 2-Clause "Simplified" License
所有者活动
Created At2019-09-09 11:44:29
Pushed At2025-02-05 13:23:20
Last Commit At
Release Count48
Last Release Namerobot3@1.1.1 (Posted on 2025-02-05 13:23:19)
First Release Namev0.2.0 (Posted on 2019-09-18 08:13:22)
用户参与
Stargazers Count2k
Watchers Count18
Fork Count91
Commits Count361
Has Issues Enabled
Issues Count103
Issue Open Count12
Pull Requests Count119
Pull Requests Open Count3
Pull Requests Close Count16
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private