Skip to content

Configuration

Default Work Runners

Safe defaults are provided for Event and Effect WorkRunners for all platforms, but you can also provide custom defaults to simplify loop creation:

MobiusHooks.setDefaultEventRunner { WorkRunners.singleThread() }
MobiusHooks.setDefaultEffectRunner { WorkRunners.fixedThreadPool(4) }

// New loops will use the provided defaults unless overridden in the builder:
val loopFactory = Mobius.loop(update, effectHandler)
val loop = loopFactory.startFrom(model)

See the platform references to understand the default WorkRunners: