Last active
March 11, 2021 16:08
-
-
Save jamestharpe/3ca4a46432dbfa032c28c0b33cfd88fe 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 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