Skip to content

0.9.0 / 2018-05-06

Choose a tag to compare

@chentsulin chentsulin released this 06 May 13:33
· 106 commits to master since this release
  • [new] effect:
const { effect } = require('bottender-compose');

bot.onEvent(
  effect(
    // function has side effects
    async context => {
      await doSomeSideEffects();
      return {
        derivedState: {
          x: 1,
        },
        derivedParam: {
          y: 2,
        },
      };
    },

    // action
    async (context, param) => {
      console.log(context.state.x); // 1
      console.log(param.y); // 2
    }
  )
);