1.1.1 • Published 6 years ago

redux-driver v1.1.1

Weekly downloads
19
License
MIT
Repository
github
Last release
6 years ago

redux-driver 1.1.0

Event-Driven / Action-Mapping Middleware for Redux with RxJS
NPM version

Install

This has peer dependencies of rxjs: ^5.3.0.
npm i -S redux-driver

Concept Intro

Act -|                            |- Act
Act -|-- Evt --> {HTTP} --> Evt --|- Act
Act -|                            |- Act
  • Map actions to events, dispatch actions from events.
  • Use events to manage http request/response.
  • Split http request out from data flow.
  • Split actions relationship mapping out from reducers.

Bind with socket.io

By driver.setup({ SocketIO: socketObj }) driver can auto-binding with socket.io's event.

Methods

Please read Docs

What's Next

  • Expand more RxJS features at event layer (delay, concat, take, etc).
  • Support directly AJAX by this module.
  • Add methods in old version back. (trigger, middle in 0.2.7)

Example

With Socket.io

import reduxDriver from 'redux-driver';
import { createStore, applyMiddleware } from 'redux';
import io from 'socket.io-client';
import reducers from './reducers';

import { userLogin, loginResult, graphReq, graphRes } from './actions/user';

const driver = reduxDriver();
const socket = io('www.domain.com', { transports: ['websocket'] });
const store = createStore(reducers, applyMiddleware(driver.middleware()));

driver.setup({ socketIO: socket });

driver.emitter({ userLogin });
driver.receiver({ loginResult });

driver.router('graphql',
  {
    emitter: graphReq,
    receiver: graphRes
  }
);

Other examples you can take a look at our test scripts.


Welcome anyone join this project : )

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago