Created
September 29, 2021 04:43
-
-
Save itacirgabral/2ea77cf325a5acec3ffe02c6bb11e1e7 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 machine = Machine({ | |
id: 'lightbulb', | |
initial: 'unlit', | |
states: { | |
lit: { | |
on: { | |
TOGGLE: 'unlit', | |
BREAK: 'broken' | |
} | |
}, | |
unlit: { | |
exit: () => {}, | |
on: { | |
TOGGLE: 'lit', | |
BREAK: { | |
target: 'broken', | |
actions: [(ctx, e) => { | |
console.log(e.myArg) | |
}, 'logB'] | |
} | |
} | |
}, | |
broken: { | |
type: 'final', | |
entry: (ctx, e) => {} // ['a', 'b'] | |
} | |
}, | |
strict: true | |
}, { | |
actions: { | |
logB: () => console.log('b') | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment