Created
December 23, 2017 00:35
-
-
Save erichulburd/e0fbafc98d237237c28029f2fe70b71a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 game = (action$, store) => | |
action$.ofType(actions.START) | |
.mergeMap(() => { | |
const interval = Observable.interval(250) | |
.takeUntil(action$.ofType( | |
actions.PAUSE, | |
actions.RESET, | |
actions.END | |
)); | |
const incrementTime = interval | |
.map(_interval => actions.incrementTime()); | |
const end = interval | |
// if the user has lost. | |
.map(_action => actions.end()); | |
return Observable.merge(incrementTime, end); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment