Last active
May 29, 2020 02:59
-
-
Save ThaddeusJiang/de3e4d2adbb2eb0c063a548f1d740f00 to your computer and use it in GitHub Desktop.
交差点の信号 statechart https://xstate.js.org/viz/?gist=de3e4d2adbb2eb0c063a548f1d740f00
This file contains hidden or 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const lightMachine = Machine({ | |
id: 'light', | |
initial: 'green', | |
states: { | |
green: { | |
on: { | |
timer: 'yello' | |
} | |
}, | |
yello: { | |
on: { | |
timer: 'red', | |
} | |
}, | |
red: { | |
on: { | |
timer: 'green' | |
} | |
}, | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment