microcosm
Advanced tools
Changelog
12.6.0
./docs/api/actions
for more informationwithSend()
. This may be used to access the original component.Changelog
12.5.0
defaults
static to Microcosm that passes default options
to the constructor and setup method.setup
, the options object passed when
instantiating a Microcosm argument, will always be an object. There
is no need to handle the null case for options.installation.md
for more detailsWe frequently pass custom options into Microcosm to configure Domains and Effects with different options based on the environment. For example, an Effect that auto-saves user data:
class Repo extends Microcosm {
setup({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
It can be cumbersome to chase down the default options, which may be
specified as defaults in individual domains/effects. With this
release, you may now define defaults using the defaults
static:
class Repo extends Microcosm {
static defaults = {
saveInterval: 5000
}
setup({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
This takes advantage of
the
Class Fields & Static Properties Spec. This
specification is still
at Stage 2, however it
has become common place to use this feature within React projects. If
living on the edge isn't your thing, defaults may also be configured
by assigning a default
property to your Microcosm subclass:
class Repo extends Microcosm {
setup({ saveInterval }) {
// ...
this.addEffect(Autosave, { saveInterval })
}
}
Repo.defaults = {
saveInterval: 5000
}
All Microcosm specific options, such as maxHistory
will get merged
into your custom defaults upon construction.
Changelog
12.4.0
repo.history.wait()
and repo.history.then()
to allow tests
to wait for all outstanding actions to complete.repo.history
documentation.