Created
October 8, 2021 17:13
-
-
Save YouMinTW/68fe859e9eef2de2667ff349d87e6dec to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const doorMachinceConfig = { | |
id: "door", | |
initial: "關著", | |
states: { | |
關著: { | |
on: { 開門: "開了" } | |
}, | |
開了: { | |
on: { | |
關門: { target: "關著" } | |
} | |
} | |
} | |
}; | |
// some FSM config | |
const someFSMConfig = { | |
id: "myId", | |
initial: "state1", | |
states: { | |
state1: { | |
on: { | |
event1: { target: "state2" } | |
} | |
}, | |
state2: { | |
on: { | |
event2: { target: "state1" } | |
}, | |
...doorMachinceConfig, | |
} | |
} | |
}; | |
const fetchMachine = Machine(someFSMConfig); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment