Releases: bottenderjs/bottender-xstate
Releases · bottenderjs/bottender-xstate
0.5.1 / 2019-10-08
v0.5.0
v0.4.1
0.4.0 / 2018-09-04
Minor Changes
- Support extended state: 5b13388
bottenderXstate({
config,
mapContextToXstateEvent,
actions,
guards: {
oneSecondElapsed: extendedState => {
const { elapsedTime } = extendedState;
console.log(`Elapsed Time: ${elapsedTime}`);
return elapsedTime >= 1000;
},
},
})
Patches
0.3.1 / 2018-08-19
Patches
- Fix transformConfig: 6f7ddde
0.3.0 / 2018-08-17
0.2.0 / 2018-08-16
0.1.0 / 2018-08-02
- [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,
})
);