Last active
May 14, 2020 03:22
-
-
Save njdancer/e0f615c6941eeb21f81656e9e11d562d 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 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