Skip to content

Instantly share code, notes, and snippets.

@hydrosquall
Created September 12, 2019 22:08
Show Gist options
  • Save hydrosquall/83b2295ea656944cbaa263ae5459c29b to your computer and use it in GitHub Desktop.
Save hydrosquall/83b2295ea656944cbaa263ae5459c29b 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 pedestrianStates = {
initial: 'walk',
states: {
walk: {
on: {
PED_TIMER: 'wait'
}
},
wait: {
on: {
PED_TIMER: 'stop'
}
},
stop: {}
}
};
const lightMachine = Machine({
id: 'light',
initial: 'green',
states: {
green: {
on: {
TIMER: 'yellow'
}
},
yellow: {
on: {
TIMER: 'red'
}
},
red: {
on: {
TIMER: 'green'
},
...pedestrianStates
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment