Nacho Portion Monitor

    babel-plugin-mst-async-action

    0.1.2 • Public • Published

    babel-plugin-mst-async-action

    npm travis-ci

    Converts mobx-state-tree async actions to flows

    TypeScript Transformer Plugin Version

    Example

    In

    import { types } from 'mobx-state-tree'
    
    const store = types.model({ count: 0 }).actions(self => ({
      async getCount() {
        self.count = await api.getCount()
      }
    }))

    Out

    import { types, flow } from 'mobx-state-tree'
    
    const store = types.model({ count: 0 }).actions(self => ({
      getCount: flow(function*() {
        self.count = yield api.getCount()
      })
    }))

    Usage

    .babelrc

    {
      "plugins": ["babel-plugin-mst-async-action"]
    }

    Install

    npm i babel-plugin-mst-async-action

    DownloadsWeekly Downloads

    4

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    10.7 kB

    Total Files

    16

    Last publish

    Collaborators

    • newraina