Skip to content

Instantly share code, notes, and snippets.

@juboba
Last active September 23, 2020 10:49
Show Gist options
  • Save juboba/5797364186f7b20b4c28e61ddd8c002c to your computer and use it in GitHub Desktop.
Save juboba/5797364186f7b20b4c28e61ddd8c002c 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 accountMachine = Machine({
id: 'User Account Machine',
initial: 'unregistered',
states: {
free: {
on: {
PAYMENT: 'master',
QUIT: 'unregistered'
}
},
master: {
on: {
QUIT: 'unregistered',
STOP_PAYING: 'free',
ADD_TO_TEAM: 'inTeam',
}
},
inTeam: {
on: {
LEAVE_TEAM: 'master',
QUIT: 'unregistered',
STOP_PAYING: 'free',
}
},
unregistered: {
on: {
REGISTER: {
target: 'free',
},
PAYMENT: {
target: 'master'
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment