# ocean-utils-test

> - 生成store，env要求development/production

Latest version **1.0.2** (published 2018-05-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install ocean-utils-test
pnpm add ocean-utils-test
yarn add ocean-utils-test
bun add ocean-utils-test
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-05-14 |
| First published | 2018-05-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 506.3 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | dp.gaoyuan@gmail.com |
| Maintainers | gaoyuan_gary |

## Links

- npm: https://www.npmjs.com/package/ocean-utils-test
- npm.io page: https://npm.io/package/ocean-utils-test

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.17.1
- [react](https://npm.io/package/react.md) ^16.2.0
- [redux](https://npm.io/package/redux.md) ^3.7.2
- [redux-saga](https://npm.io/package/redux-saga.md) ^0.16.0
- [redux-logger](https://npm.io/package/redux-logger.md) ^3.0.6

## Recent versions

- 1.0.2 (latest) — 2018-05-14
- 1.0.1 — 2018-05-14
- 1.0.0 — 2018-05-14

## README

## configStore(env)(initialState, rootReducer, rootSaga)
- 生成store，env要求development/production

examples：
```javascript
export default configStore(process.env.NODE_ENV)({}, reducer, saga);
```

## fetch
- 与 axios 一致

## helper
### helper/actionGenerator
- 生成actionType对象
examples:
```javascript
export const ACTIVITY_LIST = actionGenerator('ACTIVITY_LIST');
```
get:
```javascript
{
  ACTION: 'ACTIVITY_LIST',
  SUCCESS: 'ACTIVITY_LIST_SUCCESS',
  FAILED: 'ACTIVITY_LIST_FAILED'
}
```

### helper/createSaga
- 生成saga

```javascript
function createSaga(configs, actionType)
```

- configs是数组，包含promise和payload，promise是要异步执行的方法。payload时得到response以后adapter。promise.all得到了返回会依次作为入参传给payload方法。

- actionType是在成功/失败以后触发的事件类型

examples:
```javascript
const login = createSaga([{
  promise: authService.login,
  payload: payload => payload,
}], LOGIN);
```

## message  简单的事件队列，多用于child app之间通讯
### message/MsgRegister  注册事件
examples:

```javascript
MsgRegister('EVENT:TOGGLE_MENU', this.toggleMenu);
```

### message/MsgUnregister  取消注册

```javascript
MsgUnregister('EVENT:TOGGLE_MENU', this.toggleMenu);
```


### message/MsgTrigger  触发事件

```javascript
MsgTrigger('EVENT:TOGGLE_MENU');
```

---
_Source: https://npm.io/package/ocean-utils-test · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
