Skip to content

Instantly share code, notes, and snippets.

@meditto
Created June 5, 2021 23:34
Show Gist options
  • Save meditto/7d260a963ed00eec2d4daf350939d674 to your computer and use it in GitHub Desktop.
Save meditto/7d260a963ed00eec2d4daf350939d674 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: 'fetch',
initial: 'idle',
context: {
progress: 0
},
states: {
idle: {
on: {
unlock_first_goal: {
target: "first_goal_unlocked",
actions: assign({progress:50})
}
}
},
first_goal_unlocked: {
on: {
unlock_second_goal: {
target: "second_goal_unlocked",
actions: assign({progress:100})
}
}
},
second_goal_unlocked:{
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment