Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 01 Mar 19:26
· 139 commits to main since this release
0d4663d

Minor Changes

  • #4746 b570ba20d Thanks @davidkpiano! - The new emit(…) action creator emits events that can be received by listeners. Actors are now event emitters.

    import { emit } from 'xstate';
    
    const machine = createMachine({
      // ...
      on: {
        something: {
          actions: emit({
            type: 'emitted',
            some: 'data'
          })
        }
      }
      // ...
    });
    
    const actor = createActor(machine).start();
    
    actor.on('emitted', (event) => {
      console.log(event);
    });
    
    actor.send({ type: 'something' });
    // logs:
    // {
    //   type: 'emitted',
    //   some: 'data'
    // }
  • #4777 4abeed9df Thanks @Andarist! - Added support for params to enqueueActions