Skip to content

Instantly share code, notes, and snippets.

View parker-codes's full-sized avatar

Parker McMullin parker-codes

View GitHub Profile
@parker-codes
parker-codes / machine.js
Created December 17, 2020 17:21
Generated by XState Viz: https://xstate.js.org/viz
const terminationFormMachine = Machine({
id: 'terminationForm',
initial: 'initial',
states: {
initial: {
on: {
MANAGER_SAVE: 'saved'
}
@parker-codes
parker-codes / machine.js
Created December 17, 2020 17:18
Generated by XState Viz: https://xstate.js.org/viz
const formMachine = Machine({
id: 'form',
initial: 'initial',
states: {
initial: {
on: {
MANAGER_SAVE: 'saved'
}
const ONE_SECOND = 1000;
const ONE_MINUTE = ONE_SECOND * 60;
const machine = Machine(
{
id: 'microwave',
initial: 'idle',
context: {
const stoplightMachine = Machine({
initial: 'red',
states: {
red: {
after: {
3000: 'green'
}
},
const increment = context => context.count + 1;
const decrement = context => context.count - 1;
const reset = context => context.count = 0;
const counterMachine = Machine({
initial: 'active',
context: {
count: 0
},