Created
January 7, 2022 11:59
-
-
Save tunjid/ad5388e8473bd58f5fa6f4cc0931af6e 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
public static void main(String[] args) { | |
// Let's make a Mobius Loop | |
MobiusLoop<Integer, CounterEvent, CounterEffect> loop = Mobius | |
.loop(new CounterLogic(), new CounterEffectHandler()) | |
.startFrom(0); | |
// And start using our loop | |
loop.dispatchEvent(CounterEvent.INCREMENT); // Model is now 1 | |
loop.dispatchEvent(CounterEvent.DECREMENT); // Model is now 0 | |
loop.dispatchEvent(CounterEvent.DECREMENT); // Sound effect plays! Model is still 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment