mole-redux

1.0.4 • Public • Published

mole-redux Build Status

mole-redux is a tiny helper library that works as a middleware for redux, allowing easy state-action molejs. Underneath, it uses the report() method from mole-reporter one of the three independent packages that form the whole molejs service stack.

All the reported logs follow the mole log specification.

Requirements

Install

npm install --save mole-redux

Configure with redux

When loading your store use applyMiddleware and createStoreWithMiddleware as described by the redux docs.

import moleMiddleware from 'mole-redux';
 
/* ... */
 
let createStoreWithMiddleware = applyMiddleware(moleMiddleware);
let appReducers = combineReducers(reducers);
let store = createStoreWithMiddleware(appReducers);

Error logging

In order to actually do the logging you still need to integrate mole-reporter to implement the report and config methods.

The first thing, is to surround your application's entry point in a try-catch block. In react, this would look something like the following, though YMMV.

import Mole from 'mole-reporter';
import fetch from 'fetch';
/* import Component */
 
Mole.config({url: 'http://api.example.com/mole'});
 
try {
  React.render(Component, document.body);
} catch (error) {
  Mole.report(error);
}

Readme

Keywords

Package Sidebar

Install

npm i mole-redux

Weekly Downloads

1

Version

1.0.4

License

MIT

Last publish

Collaborators

  • filiptc
  • erizocosmico