Skip to content

Instantly share code, notes, and snippets.

@kuroski
Created February 9, 2021 09:08
Show Gist options
  • Save kuroski/b322d9a50848d20445979c95c21d245b to your computer and use it in GitHub Desktop.
Save kuroski/b322d9a50848d20445979c95c21d245b 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 exposePreparationState = {
initial: "load_deal",
states: {
load_deal: {
on: {
RESOLVE: "load_expose_data",
// REJECT: "^finish_with_error"
}
},
load_expose_data: {
on: {
RESOLVE: "decode_expose_data",
// REJECT: "^finish_with_error"
}
},
decode_expose_data: {
on: {
RESOLVE: "",
REJECT: "#appMachine.finish_with_error"
}
},
}
}
const appMachine = Machine({
id: 'appMachine',
initial: 'idle',
context: {},
states: {
idle: {
on: {
APP_MOUNTED: 'loading'
}
},
loading: {
...exposePreparationState
},
finish_with_error: {
type: "final"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment