Skip to content

Instantly share code, notes, and snippets.

@abierbaum
Created August 11, 2019 20:39
Show Gist options
  • Save abierbaum/a3f87bc8653bbad4ea6c5cde4f9e2eea to your computer and use it in GitHub Desktop.
Save abierbaum/a3f87bc8653bbad4ea6c5cde4f9e2eea 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: 'waiting',
states: {
'waiting': {
after: {
5000: { target: '#timeout' }
},
on: {
RESET: {
internal: false,
target: 'waiting'
}
}
}
},
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