Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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'
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement