Skip to content

v0.14.0-beta.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@LevelbossMike LevelbossMike released this 03 Dec 17:01
· 62 commits to master since this release

This is the first prerelease of the new updated useMachine-API that does not require ember-usable anymore but is implemented based on the `invokeHelper-API. You need to run Ember.js >= 3.24.x to use this release.

Changes in this release:

new useMachine-API

useMachine is now a helper. Thus the invocation has changed slightly:

import { useMachine, matchesState } from 'ember-statecharts';

export default class ToggleComponent extends Component {
  statechart = useMachine(this, () => {
    return {
      machine: toggleMachine.withConfig({ /* ... */ }).withContext({ /* ... */}),
      update({ machine, restart, send }) => { /* ... */}, // optional
      onTransition(state) => { /* ... */}, // optional
      initialState: this.args.state, // optional
      interpreterOptions: { /* ... */} // optional
    };
  });

  @matchesState('off') isOff;
  @matchesState('on') isOn;

  @action toggle() {
    this.statechart.send('TOGGLE');
  }
}

XState is a peer dependency now

XState now needs to be installed separately - ember-statecharts will not pull in this dependency for you anymore:


yarn add -D xstate

or

npm install --save-dev xstate

No more ember-usable

This addon does not depend on a separate useable-addon anymore. If your app relies on the previous implicit install of ember-usable you will need to install it yourself now.