Skip to content

Instantly share code, notes, and snippets.

@abierbaum
Created August 11, 2019 20:35
Show Gist options
  • Save abierbaum/c3d147ef294f6832582dc70abc5e8a45 to your computer and use it in GitHub Desktop.
Save abierbaum/c3d147ef294f6832582dc70abc5e8a45 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const countdown = Machine({
id: 'count_down',
initial: 'idle',
states: {
idle: {
on: {
START: 'running'
}
},
running: {
initial: 'start_count',
states: {
'start_count': {
/*
on: {
'': 'waiting'
}*/
after: {
1: 'waiting'
}
},
'waiting': {
after: {
5000: { target: '#timeout' }
},
on: {
RESET: {
internal: false,
target: 'start_count'
}
}
}
},
on: {
DISCONNECT: 'idle'
}
},
timeout: {
id: 'timeout',
on: {
CLEAR: 'idle'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment