github statelyai/xstate @xstate/vue@0.5.0

latest releases: @xstate/svelte@3.0.5, @xstate/vue@3.1.4, @xstate/store@2.6.0...
3 years ago

Minor Changes

  • 9f6a6e9e #1991 Thanks @santicros! - Added new useActor, which is a composable that subscribes to emitted changes from an existing actor:

    import { useActor } from '@xstate/vue';
    
    export default defineComponent({
      props: ['someSpawnedActor'],
      setup(props) {
        const { state, send } = useActor(props.someSpawnedActor);
        return { state, send };
      }
    });
  • bfe42972 #1991 Thanks @santicros! - Fixed the UMD build by externalizing XState & Vue correctly.

  • 4346cabc #1991 Thanks @santicros! - Added new useInterpret, which is a low-level composable that interprets the machine and returns the service:

    import { useInterpret } from '@xstate/vue';
    import { someMachine } from '../path/to/someMachine';
    export default defineComponent({
      setup() {
        const state = ref();
        const service = useInterpret(machine, {}, nextState => {
          state.value = nextState.value;
        });
        return { service, state };
      }
    });
  • 012ef363 #1991 Thanks @santicros! - Added a proper ESM file using the"module" field in the package.json. It helps bundlers to automatically pick this over a file authored using CommonJS and allows them to apply some optimizations easier.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.