Skip to content

Instantly share code, notes, and snippets.

@isaacplmann
Last active November 12, 2019 16:21
Show Gist options
  • Save isaacplmann/2eca42a9260399001c3fa74dc0f22573 to your computer and use it in GitHub Desktop.
Save isaacplmann/2eca42a9260399001c3fa74dc0f22573 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 myMachine = Machine({
id: 'slide',
initial: 'ground',
states: {
ground: {
on: {
CLIMB_UP: 'ladder'
}
},
ladder: {
initial: 'step1',
states: {
step1: {
on: {
CLIMB_UP: 'step2',
CLIMB_DOWN: '#slide.ground'
}
},
step2: {
on: {
CLIMB_UP: '#slide.topOfSlide',
CLIMB_DOWN: 'step1'
}
}
}
},
topOfSlide: {
on: {
CLIMB_DOWN: 'ladder.step2',
SLIDE: 'ground'
}
},
}
})
// Add a flying state
// Add FLY and LAND events
// LAND should go back to wherever you flew from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment