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"]
}

Dependencies (1)

Dev Dependencies (4)

Package Sidebar

Install

npm i babel-plugin-mst-async-action

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

10.7 kB

Total Files

16

Last publish

Collaborators

  • newraina