Skip to content

Instantly share code, notes, and snippets.

@dra1n
Last active December 2, 2020 07:55
Show Gist options
  • Select an option

  • Save dra1n/162414a7f2d16f6ad3fc6f44b00f1eed to your computer and use it in GitHub Desktop.

Select an option

Save dra1n/162414a7f2d16f6ad3fc6f44b00f1eed to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const getHomeMachine = Machine({
initial: 'global',
states: {
global: {
initial: 'walking',
on: {
RIDE_TAXI: 'global.riding.taxi',
RIDE_BUS: 'global.riding.bus'
},
states: {
idle: {
on: {
RIDE: 'riding',
WALK: 'walking'
}
},
walking: {
on: {
RIDE: 'riding',
WALK: 'idle'
}
},
riding: {
initial: 'bus',
on: {
WALK: 'walking',
RIDE: 'idle',
},
states: {
bus: {},
taxi: {}
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment