Releases: LevelbossMike/ember-statecharts
Release 0.12.0
0.12.0 (2020-08-25)
This release adds two new features:
-
The
onTransition
-hook can be used to react to statechart state changes from the outside. This is useful when you want to persist statechanges or for instrumentation, logging etc. -onTransition
behaves the same way as xstate's own interpreter#onTransition. -
To align
ember-statecharts
withxstate/react
,xstate/vue
andxstate
's own interpreter functionalityember-statecharts
now allows starting the interpreter thatuseMachine
creates in a specific state - overriding the usualinitialState
.
const machine = Machine({
initial: 'inactive',
states: {
inactive: {
on: {
START: 'active',
},
},
active: {
on: {
STOP: 'inactive',
},
},
},
});
class Test extends Component {
@use statechart = useMachine(machine, { state: this.args.state })
}
The above code will start the statechart in the active
state.
The restart
function in the update
-hook will take this state into account as well:
class Test extends Component {
@use statechart = useMachine(machine, { state: this.args.state })
.update(({ restart }) => {
// will restart interpreter in this.args.state
restart();
})
}
In addition to starting/restarting automatically in the state passed in interpreterOptions ember-statecharts
now also allows passing the state that the interpreter should be restarted in:
class Test extends Component {
@use statechart = useMachine(wizardMachine)
.withContext({
step: this.args.step
})
.update(({ restart, context: { step } }) => {
// will restart interpreter in the state passed as `args.step`
restart(step);
})
}
Features
Release 0.11.0
0.11.0 (2020-07-04)
Bug Fixes
or
not working with newmatchesState
(2168822)- allow interpreter options to be passed to override devTool / other things if desired (except the clock) (997bc9e)
- check for passed in machine (ce31e89)
- handle machine creation in useMachine function (22e35b8)
- Update CHANGELOG.md v0.10.0-beta.0 (2060e40)
Features
Release 0.10.0
Release 0.10.0-beta.1
0.10.0-beta.1 (2020-06-04)
Bug Fixes
- allow interpreter options to be passed to override devTool / other things if desired (except the clock) (0fa019a)
- check for passed in machine (2cf1c0f)
- handle machine creation in useMachine function (96769be)
- Update CHANGELOG.md v0.10.0-beta.0 (84cb5b0)
Features
useMachine-beta.0
This beta release of ember-statecharts
comes with an improved api to work with xstate-machines directly - useMachine
. Please refer to #235 for details about the idea behind useMachine
and make sure to report any issues you find.
🚀 Enhancement / Feature
- #235 Initial
implementationuseMachine
-api
Committers: 1
- Michael Klein (@LevelbossMike)
@useMachine(TestMachine)
.withConfig(/*...*/)
.withContext(/*...*/)
Related issue: #235
v0.9.0
v0.9.0 (2020-04-09)
🏠 Internal
See xstate#4.8.0 - release notes for new xstate release notes.
Committers: 2
- Clemens M�ller (@pangratz)
- Michael Klein (@LevelbossMike)
v0.8.2
v0.8.2 (2019-07-05)
🏠 Internal
- c0dec97 Update xstate to 4.6.4 (@LevelbossMike)
See xstate#4.6.4 - release notes for new xstate release notes.
Committers: 1
- Michael Klein (@LevelbossMike)
v0.8.1
v0.8.1 (2019-07-05)
🚀 Enhancement / Feature
- #118 Add addon-docs (@LevelbossMike)
Finally we have an addon-docs page 🚀 - https://www.ember-statecharts.com
Committers: 1
- Michael Klein (@LevelbossMike)
v0.8.0
v0.8.0 (2019-06-16)
🚀 Enhancement / Feature
- dda27d6 Improve
matchesState
anddebugState
(@LevelbossMike)
matchesState
and debugState
now also support statecharts that are named differently than statechart
.
export default Component.extend({
// ...
isOn: matchesState('on', 'customStatechartName'),
_debug: debugState('customStatechartName'),
customStatechartName: statechart({
initial: 'off',
states: {
off: {
on: {
POWER: 'on',
},
},
on: {
on: {
POWER: 'off',
},
},
},
}),
});
🏠 Internal
- #102 Update ember-cli 3.10.x, xstate, prettier (@LevelbossMike)
See xstate#4.6.0 - release notes for new xstate features.
Committers: 1
- Michael Klein (@LevelbossMike)