Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

inst-redux-service-middleware

13.5.0 • Public • Published
  1. While creating your store, register your services as key/value pairs with the service middleware constructor:
  applyMiddleware(
    createServiceMiddleware({
      myKey: myService,
      myOtherKey: myOtherService
    })
  )
  1. In your action creator, dispatch an action with the following shape:
  {
    type: serviceMiddleware.CALL_SERVICE
    payload: {
      service: 'myKey'
      method: 'methodName'
      args: [arg1, arg2]
    }
  }

Subsequent calls to dispatch with your action creator will return the result of calling myService.methodName(arg1, arg2)

Keywords

none

install

npm i inst-redux-service-middleware

Downloadsweekly downloads

30

version

13.5.0

license

MIT

repository

Gitgerrit

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability