Created
April 6, 2020 13:10
-
-
Save jacobparis/5947d4bce0df8b946e5144cc6d485d6b 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const calculatorMachine = Machine({ | |
id: 'calculator', | |
initial: 'results', | |
states: { | |
results: { | |
on: { | |
OPERAND: 'operand_a', | |
MINUS: 'operand_a.negative' | |
} | |
}, | |
operand_a: { | |
on: { | |
OPERAND: {}, | |
OPERATOR: 'operator' | |
}, | |
initial: 'positive', | |
states: { | |
positive: {}, | |
negative: {} | |
} | |
}, | |
operator: { | |
on: { | |
OPERAND: 'operand_b', | |
MINUS: 'operand_b.negative' | |
} | |
}, | |
operand_b: { | |
on: { | |
OPERAND: {}, | |
OPERATOR: 'operator', | |
EQUALS: 'results' | |
}, | |
initial: 'positive', | |
states: { | |
positive: {}, | |
negative: {} | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment