@geut/mst-drama

0.0.3 • Public • Published

mst-drama

an event or situation, especially an unexpected one, in which there is worry or excitement and usually a lot of action

Build Status Stability: Experimental

Contents

Introduction

Drama is a set of functions that help you to work with mobx-state-tree and their actions.

At the moment there are only 2 functions:

connectReduxDevtools(remotedev: object, store: object, options: { trackYield: false })

connectReduxDevtools works similar to the original connect from MST but also tracks each yield in your async actions so you can see in the redux devtool how the state mutates in each step.

...
import { connectReduxDevtools } from '@geut/mst-drama';
...
connectReduxDevtools(require('remotedev'), store);

connect-redux-devtool

flowMap(actions: object)

flowMap iterates over an object of actions and converts each generator function found in a flow async action.

...
import { flowMap } from '@geut/mst-drama';

const Todo = types.model({
        title: types.string
    })
    .actions(self => flowMap({
        setTitle(newTitle) {
            self.title = newTitle
        },
        *asyncSetTitle(newTitle) {
            yield delay(2000);
            self.title = newTitle;
        }
    }))

Installation

  • NPM: npm install @geut/mst-drama
  • Yarn: yarn add @geut/mst-drama

Package Sidebar

Install

npm i @geut/mst-drama

Weekly Downloads

3

Version

0.0.3

License

MIT

Last publish

Collaborators

  • geutuser
  • the-real-dk
  • tinchoz49
  • estebanprimost