Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // Missing a reconnect
  2.  
  3. const countdown = Machine({
  4. id: 'count_down',
  5. initial: 'idle',
  6. states: {
  7. idle: {
  8. on: {
  9. START: 'running'
  10. }
  11. },
  12. running: {
  13. initial: 'waiting',
  14. states: {
  15. 'waiting': {
  16. after: {
  17. 5000: { target: '#timeout' }
  18. },
  19. on: {
  20. RESET: {
  21. internal: false,
  22. target: 'waiting'
  23. }
  24. }
  25. }
  26. },
  27. on: {
  28. DISCONNECT: 'idle'
  29. }
  30. },
  31. timeout: {
  32. id: 'timeout',
  33. on: {
  34. CLEAR: 'idle'
  35. }
  36. }
  37. }
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement