Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Created June 4, 2020 10:13
Show Gist options
  • Save RafalFilipek/9ff0ec499c427519d883bf629b0597e4 to your computer and use it in GitHub Desktop.
Save RafalFilipek/9ff0ec499c427519d883bf629b0597e4 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
/**
* wybierz = actions.choose([{
cond: 'isPhone',
target: 'phone'
},{
cond: 'isPesel',
target: 'pesel'
}, {
cond: 'isEmail',
target: 'email'
}])
}
}
}, */
const m = Machine({
initial: 'common',
states: {
common: {
on: {
SET_DATA: {
actions: 'wybierz'
}
},
initial: 'unknown',
states: {
unknown: {},
phone: {
invoke: {
src: 'phoneCostam',
onDone: {
target: '#phone'
}
}
},
pesel: {
invoke: {
src: 'peselCostam',
onDone: {
target: '#pesel'
}
}
},
email: {
invoke: {
src: 'emailCostam',
onDone: {
target: '#email'
}
}
},
},
},
phone: {id: 'phone', on: {OK: { target: 'success' }}},
email: {id: 'email', on: {OK: { target: 'success' }}},
pesel: {id: 'pesel', on: {OK: { target: 'success' }}},
success: {}
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment