Last active
September 14, 2020 03:06
-
-
Save tomByrer/86390c6162346d3284862d9611b18074 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 superButton = Machine( | |
{ | |
id: 'superButton', | |
initial: 'ready', | |
context: { | |
disabled: 0 | |
}, | |
states: { | |
ready: { | |
on: { | |
DISABLE: 'disabled', | |
CHECK: 'processing', | |
}, | |
}, | |
disabled: { | |
on: { | |
ENABLE: 'ready', | |
}, | |
}, | |
processing: { | |
on: { | |
SUCCEED: 'succeeded', | |
FAIL: 'failed', | |
}, | |
}, | |
succeeded: { | |
on: { | |
NEXT: 'ready', | |
}, | |
}, | |
failed: { | |
on: { | |
RESET: 'ready', | |
RETRY: 'processing', | |
}, | |
}, | |
}, | |
}, | |
{ | |
actions: { | |
myAction: () => { | |
console.log("myAction"); | |
}, | |
}, | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment