Last active
November 8, 2021 16:53
-
-
Save robertpenner/d5587ae6f92e4f9d83f92470a349fc54 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 machine = Machine( | |
{ | |
id: "Stories", | |
type: "parallel", | |
states: { | |
playback: { | |
initial: "playing", | |
states: { | |
playing: { | |
initial: "counting down", | |
states: { | |
"counting down": { | |
after: { | |
countdown: { | |
target: "advancing", | |
}, | |
}, | |
}, | |
advancing: { | |
entry: send("NEXT"), | |
after: { | |
transition: { | |
target: "counting down", | |
}, | |
}, | |
// on: { | |
// "": [{ target: "counting down" }], | |
// }, | |
}, | |
}, | |
on: { PAUSE: "paused" }, | |
}, | |
paused: { | |
on: { RESUME: "playing" }, | |
}, | |
}, | |
}, | |
content: { | |
initial: "part 1", | |
states: { | |
"part 1": { | |
on: { | |
NEXT: "part 2", | |
}, | |
// after: { | |
// 3000: "part 2", | |
// }, | |
}, | |
"part 2": { | |
on: { | |
BACK: "part 1", | |
NEXT: "part N", | |
}, | |
// after: { | |
// 5000: "part N", | |
// }, | |
}, | |
"part N": { | |
on: { | |
BACK: "part 2", | |
NEXT: "done", | |
}, | |
// after: { | |
// 3000: "done", | |
// }, | |
}, | |
done: { | |
on: { | |
NEXT: "part 1", | |
}, | |
// after: { | |
// 5000: "part 1", | |
// }, | |
}, | |
}, | |
}, | |
}, | |
}, | |
{ | |
delays: { | |
countdown: 5000, | |
transition: 1000, | |
}, | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment