Skip to content

Instantly share code, notes, and snippets.

@phanmn
Last active March 7, 2021 17:20
Show Gist options
  • Save phanmn/4dd56a6b415a6c91098e6b9621772d8d to your computer and use it in GitHub Desktop.
Save phanmn/4dd56a6b415a6c91098e6b9621772d8d 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 roomMachine = Machine({
id: 'room',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
START_ROOM: 'starting'
}
},
starting: {
on: {
RESOLVE: 'started',
REJECT: 'idle',
STOP_ROOM: 'ending',
}
},
started: {
on: {
STOP_ROOM: 'ending',
}
},
ending: {
on: {
RESOLVE: "ended",
},
},
ended: {
type: 'final',
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment