Last active
January 7, 2020 18:13
-
-
Save boertel/652fbaf76bdb1029accb7ec70b81d17f 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
const lightMachine = Machine({ | |
id: 'gvg', | |
type: 'parallel', | |
states: { | |
art: { | |
initial: 'green', | |
states: { | |
green: { | |
after: { | |
2000: 'red', | |
} | |
}, | |
red: { | |
after: { | |
2000: 'blue' | |
} | |
}, | |
blue: { | |
after: { | |
2000: 'green', | |
} | |
}, | |
black: {} | |
} | |
}, | |
app: { | |
initial: 'hidden', | |
states: { | |
hidden: { | |
on: { | |
TAP: 'bottom' | |
} | |
}, | |
bottom: { | |
after: { | |
2000: 'hidden' | |
}, | |
on: { | |
HIDE: 'hidden', | |
OPEN: 'full', | |
} | |
}, | |
full: { | |
on: { | |
HIDE: 'hidden' | |
} | |
}, | |
sleep: { | |
initial: 'waiting', | |
states: { | |
waiting: { | |
after: { | |
5000: 'sleeping', | |
}, | |
on: { | |
SLEEPING: 'sleeping', | |
} | |
}, | |
sleeping: {} | |
} | |
}, | |
settings: {}, | |
} | |
} | |
}, | |
on: { | |
SLEEP: { | |
target: ['.app.sleep', '.art.black'] | |
}, | |
SETTINGS: { | |
target: ['.app.settings', '.art.black'] | |
}, | |
CLOSE: { | |
target: ['.art.green', 'app.hidden'] | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment