1.0.13 • Published 4 years ago
@ohbug/redux-middleware v1.0.13
@ohbug/redux-middleware
English | 简体中文
Installation
yarn add @ohbug/browser @ohbug/redux-middleware
Usage
import Ohbug from '@ohbug/browser'
import { createStore, applyMiddleware } from 'redux'
import createOhbugMiddleware from '@ohbug/redux-middleware'
import reducer from './reducer'
Ohbug.init({ apiKey: 'YOUR_API_KEY' })
const store = createStore(reducer, applyMiddleware(createOhbugMiddleware()))
API
import type { Action, MiddlewareAPI } from 'redux'
type CreateOhbugMiddlewareOption = (
action: Action,
store: MiddlewareAPI
) => Action | false
example
import type { Action, MiddlewareAPI } from 'redux'
function before(action: Action, store: MiddlewareAPI) {
if (action.type === 'foo') {
// You can filter on certain sensitive information, which will not be collected
// Just return false
return false
} else if (action.type === 'bar') {
// If you want to collect some data after processing
return {
type: action.type,
payload: store.getState() + action.payload,
}
}
return action
}
// ...
const store = createStore(
reducer,
applyMiddleware(createOhbugMiddleware(before))
)
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.2-alpha.0
5 years ago
1.0.1-alpha.0
5 years ago
1.0.0-alpha.0
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago