Skip to content

Instantly share code, notes, and snippets.

@eugenekgn
Last active December 25, 2019 17:54
Show Gist options
  • Save eugenekgn/ec38ff51642dd4880b4fc499c86cc1be to your computer and use it in GitHub Desktop.
Save eugenekgn/ec38ff51642dd4880b4fc499c86cc1be to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'lightBult',
initial: 'unlit',
states: {
lit: {
on: {
BREAK: {
target: 'broken',
actions: ['logBroken']
}
}
},
unlit: {
on: {
BREAK: {
target: 'broken',
actions: ['logBroken']
}
}
},
broken: {
}
},
}, {
actions:{
logBroken: (context, event)=>{
console.log(`yo, I am broke ${event.location}`)
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment