Skip to content

Instantly share code, notes, and snippets.

@jacobparis
Created April 5, 2020 01:31
Show Gist options
  • Save jacobparis/287ae37cfc1db9c5c098ea3ae4057a60 to your computer and use it in GitHub Desktop.
Save jacobparis/287ae37cfc1db9c5c098ea3ae4057a60 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 formatMachine = Machine({
id: 'format',
initial: 'unformatted',
states: {
unformatted: {
on: {
BOLD: 'bold',
ITALICIZE: 'italic',
UNDERLINE: 'underlined'
}
},
bold: {
on: {
BOLD: 'unformatted',
ITALICIZE: 'bold_italic',
UNDERLINE: 'bold_underlined'
}
},
italic: {
on: {
BOLD: 'bold_italic',
ITALICIZE: 'unformatted',
UNDERLINE: 'italic_underlined'
}
},
bold_italic: {
on: {
BOLD: 'italic',
ITALICIZE: 'bold',
UNDERLINE: 'bold_italic_underlined'
}
},
underlined: {
on: {
BOLD: 'bold_underlined',
ITALICIZE: 'italic_underlined',
UNDERLINE: 'unformatted'
}
},
bold_underlined: {
on: {
BOLD: 'underlined',
ITALICIZE: 'bold_italic_underlined',
UNDERLINE: 'bold'
}
},
italic_underlined: {
on: {
BOLD: 'bold_italic_underlined',
ITALICIZE: 'underlined',
UNDERLINE: 'italic'
}
},
bold_italic_underlined: {
on: {
BOLD: 'italic_underlined',
ITALICIZE: 'bold_underlined',
UNDERLINE: 'bold_italic'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment