Created
July 4, 2019 08:06
-
-
Save heypoom/a697b167f9bbe388613cd58a9225ce41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const urinal = Machine({ | |
id: 'urinal', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { | |
OBJECT_FOUND: 'rinsing' | |
} | |
}, | |
// rinse for 2 seconds, then off. | |
rinsing: { | |
on: { | |
RINSE_COMPLETE: 'detecting' | |
} | |
}, | |
// When the object is gone, do the cleanup rinsing. | |
detecting: { | |
on: { | |
OBJECT_GONE: 'cleanup_rinsing', | |
OBJECT_FOUND: 'rinsing' | |
} | |
}, | |
// Rinse for 5 seconds then turn off | |
cleanup_rinsing: { | |
on: { | |
RINSE_COMPLETE: 'inactive' | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment