Skip to content

Instantly share code, notes, and snippets.

@jamestharpe
Last active March 11, 2021 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamestharpe/3ca4a46432dbfa032c28c0b33cfd88fe to your computer and use it in GitHub Desktop.
Save jamestharpe/3ca4a46432dbfa032c28c0b33cfd88fe 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 gasStation = Machine({
id: "dynamic",
initial: "prerequisites",
states: {
prerequisites: {
type: "parallel",
onDone: "pump",
states: {
prepayment: {
initial: "needed",
states: {
needed: {
on: {
PRE_PAY: "processing"
}
},
processing: {
on: {
PAYMENT_SUCCESS: "done",
PAYMENT_ACCEPTED: "needed"
}
},
done: {
type: "final"
}
}
},
grade: {
initial: "needed",
states: {
needed: {
on: {
SELECT_GRADE: "done"
}
},
done: {
type: "final"
}
}
}
}
},
pump: {
on: {
PUMP_GAS: "done"
}
},
done: {
on: {
RESET: "prerequisites"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment