Skip to content

Releases: bottenderjs/bottender-xstate

0.5.1 / 2019-10-08

07 Oct 16:13
Compare
Choose a tag to compare

Patches

  • Fix: avoid crash when received undefiend event: c68f5d9
  • Use named function: 4eb37c7

v0.5.0

19 Nov 09:33
Compare
Choose a tag to compare

Minor Changes

Patches

  • Modify examples to fit xstate 4: 221e6e9

v0.4.1

11 Oct 07:30
Compare
Choose a tag to compare

Minor Changes

0.4.0 / 2018-09-04

04 Sep 12:10
Compare
Choose a tag to compare

Minor Changes

  bottenderXstate({
    config,
    mapContextToXstateEvent,
    actions,
    guards: {
      oneSecondElapsed: extendedState => {
        const { elapsedTime } = extendedState;

        console.log(`Elapsed Time: ${elapsedTime}`);

        return elapsedTime >= 1000;
      },
    },
  })

Patches

  • Add transition actions example: f932870
  • Update history example: a5fbc0a

0.3.1 / 2018-08-19

19 Aug 11:28
Compare
Choose a tag to compare

Patches

0.3.0 / 2018-08-17

17 Aug 03:56
Compare
Choose a tag to compare

Minor Changes

  • Rename actionMap to actions: 700b39c
  • Add catch all event (*) implementation: cd350ba

0.2.0 / 2018-08-16

16 Aug 08:21
Compare
Choose a tag to compare

Minor Changes

Patches

0.1.0 / 2018-08-02

02 Aug 08:53
Compare
Choose a tag to compare
  • [new] Implement basic usage:
const bottenderXState = require('bottender-xstate');

const config = {
  key: 'light',
  initial: 'green',
  states: {
    green: {
      on: {
        TIMER: 'yellow',
      },
      onEntry: 'enterGreen',
      onExit: 'leaveGreen',
    },
    yellow: {
      on: {
        TIMER: 'red',
      },
      onEntry: 'enterYellow',
      onExit: 'leaveYellow',
    },
    red: {
      on: {
        TIMER: 'green',
      },
      onEntry: 'enterRed',
      onExit: 'leaveRed',
    },
  },
};

const mapContextToXStateEvent = () => 'TIMER';

const actionMap = {
  enterGreen: context => context.sendText('enter green'),
  enterYellow: context => context.sendText('enter yellow'),
  enterRed: context => context.sendText('enter red'),
  leaveGreen: context => context.sendText('leave green'),
  leaveYellow: context => context.sendText('leave yellow'),
  leaveRed: context => context.sendText('leave red'),
};

bot.onEvent(
  bottenderXState({
    config,
    mapContextToXStateEvent,
    actionMap,
  })
);