Skip to content

Instantly share code, notes, and snippets.

@gregplaysguitar
Last active August 9, 2021 22:15
Show Gist options
  • Save gregplaysguitar/a6555d68e4ca123bca809f851abdc507 to your computer and use it in GitHub Desktop.
Save gregplaysguitar/a6555d68e4ca123bca809f851abdc507 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 inviteMachine = Machine({
id: 'invite',
initial: 'invited',
states: {
invited: {
on: {
ACCEPT: 'active',
CANCEL: 'cancelled'
},
entry: 'sendInvite'
},
active: {
on: {
DEACTIVATE: 'inactive'
}
},
inactive: {
on: {
ACTIVATE: 'active',
DELETE: 'deleted'
}
},
cancelled: {
on: {
INVITE: 'invited',
DELETE: 'deleted'
}
},
deleted: {
type: 'final'
}
},
actions: {
sendInvite: (context, event) => {
console.log('Sending invite...');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment