@wethecurious/curios-reduxmiddleware-analytics
v0.0.8
Published
We The Curious analytics middleware
Downloads
29
Readme
CURIOS MIDDLEWARE REDUX SERIAL
Rationale
This middleware will establish a connection an mqtt connection to the analytics database to allow actions to be logged
If not connected to mqtt it will fall back to a non functional stub which will simulate action dispatches
Installation
npm i -s @wethecurious/curios-redux-middleware-analytics
At your createStore
import { createAnalyticsMiddleware } from 'redux-middleware-analytics'
const mqttMiddleware = createAnalyticsMiddleware({
app: string,
mqttBroker: 'localhost:1883'
})
const store = createStore(
reducer,
applyMiddleware(mqttMiddleware)
)
store.dispatch('@@CURIOS_INIT') // this is the desfault action which tells the analytics to attempt to connect