2.4.1 • Published 1 year ago

fusion-rpc-redux v2.4.1

Weekly downloads
227
License
MIT
Repository
github
Last release
1 year ago

fusion-rpc-redux

Build status

A collection of helper functions for working with Redux and RPC together

If using RPC from React components, you should use fusion-plugin-rpc-redux-react instead of this package.


Table of contents


Installation

yarn add fusion-rpc-redux

API

createRPCActions

import {createRPCActions} from 'fusion-rpc-redux';

Creates start, success and failure actions for an RPC method name. Basically, assuming a RPC method named myMethod, it lets you write start({foo: 123}) instead of {type: 'MY_METHOD_START', payload: {foo: 123}}

Types
const actions: Actions = createRPCActions((rpcId: string));
  • rpcId: string - The RPC method name
  • returns actions: {start: (arg:T) => Action<T>, success: (arg:T) => Action<T>, failure: (T) => Action<T>}
type Action<T> = {
  type: string,
  payload: T,
};

For example, if rpcId is doSomething, createRPCActions generates the actions DO_SOMETHING_START, DO_SOMETHING_SUCCESS, and DO_SOMETHING_FAILURE.

createRPCReducer

import {createRPCReducer} from 'fusion-rpc-redux';

Creates a reducer that is composed of reducers that respond to start, success and failure actions.

const reducer: Reducer = createRPCReducer(rpcId: string, {
  start: ?Reducer,
  success: ?Reducer,
  failure: ?Reducer,
}, defaultValue: any);
2.4.1

1 year ago

2.4.0

1 year ago

2.3.4

2 years ago

2.3.3

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.0

3 years ago

2.2.7

3 years ago

2.2.6

3 years ago

2.2.5

3 years ago

2.2.4

3 years ago

2.2.3

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.4.1

5 years ago

1.4.1-0

5 years ago

1.4.0

5 years ago

1.4.0-1

5 years ago

1.4.0-0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.3-0

6 years ago

1.1.2

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

7 years ago

0.2.0

7 years ago