Skip to content

Instantly share code, notes, and snippets.

@tunjid
Created January 7, 2022 11:59
Show Gist options
  • Save tunjid/ad5388e8473bd58f5fa6f4cc0931af6e to your computer and use it in GitHub Desktop.
Save tunjid/ad5388e8473bd58f5fa6f4cc0931af6e to your computer and use it in GitHub Desktop.
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