# redux-mitt

> redux-mitt

Latest version **2.1.2** (published 2018-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-mitt
pnpm add redux-mitt
yarn add redux-mitt
bun add redux-mitt
```

## 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 | 2.1.2 |
| Published | 2018-03-27 |
| First published | 2018-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | takefumi-yoshii |
| Maintainers | takepepe |

## Links

- npm: https://www.npmjs.com/package/redux-mitt
- Repository: https://github.com/takefumi-yoshii/redux-mitt
- Homepage: https://github.com/takefumi-yoshii/redux-mitt#readme
- Issues: https://github.com/takefumi-yoshii/redux-mitt/issues
- npm.io page: https://npm.io/package/redux-mitt

## Dependencies (1)

- [mitt](https://npm.io/package/mitt.md) 1.1.3

## Recent versions

- 2.1.2 (latest) — 2018-03-27
- 2.1.1 — 2018-03-27
- 2.1.0 — 2018-03-27
- 2.0.0 — 2018-03-22
- 1.1.1 — 2018-02-14
- 1.1.0 — 2018-02-14
- 1.0.8 — 2018-02-06
- 1.0.7 — 2018-02-06
- 1.0.6 — 2018-02-06
- 1.0.5 — 2018-02-05
- 1.0.4 — 2018-02-05
- 1.0.3 — 2018-02-05
- 1.0.2 — 2018-02-05
- 1.0.1 — 2018-02-05
- 1.0.0 — 2018-02-05

## README

# redux-mitt

[![Latest Version](https://img.shields.io/badge/npm-v2.1.0-C12127.svg)](https://www.npmjs.com/package/redux-mitt)
[![CircleCI](https://circleci.com/gh/takefumi-yoshii/redux-mitt/tree/master.svg?style=svg)](https://circleci.com/gh/takefumi-yoshii/redux-mitt/tree/master)

## what is this?

The redux standard API does not have an easy way to subscribe Actions and unsubscribe them.added this as a lightweight function.

## install

```sh
$ npm install --save redux-mitt
```

## setup

```javascript
import { createStore, applyMiddleware } from 'redux'
import { mittMiddleware } from 'redux-mitt'

const reducer = () => {}
const store = createStore(reducer, mittMiddleware())
```
## usage

```javascript
const type = 'TEST'
const payload = { test: 'test' }
const creator = () => { return { type, payload }}
const unsubscribe = store.subscribeAction(type, action => {
  console.log(action) // { type: 'TEST', payload: { test: 'test'} }
})
// unsubscribe() # unsubscribe action
store.dispatch(creator())
```

## API

### subscribeAction(type, handler)

The first argument specifies the action type. Specific action `ex:) 'SOME_ACTION'` or wildcard `'*'` can subscribe.The second argument is callback with action.

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