Skip to content

Instantly share code, notes, and snippets.

@leeh
Last active May 26, 2021 13:41
Show Gist options
  • Save leeh/77f4e238b2d8a16c036158054e290536 to your computer and use it in GitHub Desktop.
Save leeh/77f4e238b2d8a16c036158054e290536 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 fetchMachine = Machine({
id: 'Simulcast',
initial: 'new',
context: {
elapsed: 0
},
states: {
new: {
on: {
SAVE: { target: 'pending' },
},
},
pending: {
on: {
ACTIVATE: { target: 'inuse' },
},
initial: 'scheduling',
states: {
scheduling: {
on: {
SCHEDULE: { target: 'scheduled' },
},
},
scheduled: {
on: {
EXPIRE: { target: 'expired' },
},
},
expired: {
type: 'final',
},
},
},
inuse: {
initial: 'activating',
states: {
activating: {
on: {
ACTIVATED: { target: 'active' },
},
},
active: {
on: {
START: { target: 'starting' },
},
},
starting: {
on: {
START_COMPLETE: { target: 'live' },
},
},
live: {
on: {
STOP: { target: 'stopping' },
},
},
stopping: {
on: {
STOP_COMPLETE: { target: 'completed' },
},
},
completed: {
type: 'final',
},
}
},
error: {},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment