Skip to content

Instantly share code, notes, and snippets.

@njdancer
Last active May 14, 2020 03:22
Show Gist options
  • Save njdancer/e0f615c6941eeb21f81656e9e11d562d to your computer and use it in GitHub Desktop.
Save njdancer/e0f615c6941eeb21f81656e9e11d562d 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 publicParkingMachine = Machine({
id: 'publicParking',
initial: 'loading',
context: {
},
states: {
idle: {
on: {
SEARCH: "loading"
}
},
loading: {
initial: "coordinate",
states: {
coordinate: {
invoke: {
id: "loadCoordinateForSearchTerm",
src: "loadCoordinateForSearchTerm",
onDone: "results",
onError: "#publicParking.error"
}
},
results: {
invoke: {
id: "loadResultsForCoordinate",
src: "loadResultsForCoordinate",
onDone: "#publicParking.idle",
onError: "#publicParking.error"
}
}
}
},
error: {
on: {
SEARCH: "loading"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment