Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remote-redux-devtools

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remote-redux-devtools

Relay Redux actions to remote Redux DevTools.

  • 0.5.0-alpha
  • alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
decreased by-14.54%
Maintainers
1
Weekly downloads
 
Created
Source

Remote Redux DevTools

Demo

Use Redux DevTools remotely for React Native, hybrid, desktop and server side Redux apps.

Installation

npm install --save-dev remote-redux-devtools

Usage

Just add our store enhancer to your store:

store/configureStore.js
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import devTools from 'remote-redux-devtools';
import reducer from '../reducers';

export default function configureStore(initialState) {
  const enhancer = compose(
    applyMiddleware(thunk),
    devTools()
  );
  // Note: passing enhancer as last argument requires redux@>=3.1.0
  const store = createStore(reducer, initialState, enhancer);
  // If you have other enhancers & middlewares
  // update the store after creating / changing to allow devTools to use them
  devTools.updateStore(store);
  return store;
}
Important

In order not to allow it in production by default, the enhancer will have effect only when process.env.NODE_ENV === 'development'. In case you don't set NODE_ENV or want to use it in production, set realtime parameter to true:

const enhancer = compose(
  applyMiddleware(thunk),
  devTools({ realtime: true })
);

Monitoring

Use one of our monitor apps to inspect and dispatch actions:

Use remotedev-app to create your own monitor app.

Communicate via local server

In order to make it simple to use, by default, the module and the monitor app communicate via remotedev.io server. Use remotedev-server cli to run it locally in order to make the connection faster and not to require an internet connection. You can import it in your server.js script and start remotedev server together with your development server:

var remotedev = require('remotedev-server');
remotedev({ hostname: 'localhost', port: 8000 });

See remotedev-server repository for more details. For React Native you can use react-native-debugger or remote-redux-devtools-on-debugger, which already include remotedev-server.

Parameters

NameDescription
nameString representing the instance name to be shown on the remote monitor.
realtimeBoolean specifies whether to allow remote monitoring. By default is process.env.NODE_ENV === 'development'.
hostnameString used to specify host for remotedev-server. If port is specified, default value is localhost.
portNumber used to specify host's port for remotedev-server.
secureBoolean specifies whether to use https protocol for remotedev-server.
maxAgeNumber of maximum allowed actions to be stored on the history tree, the oldest actions are removed once maxAge is reached. Default is 30.
filtersMap of arrays named whitelist or blacklist to filter action types. See the example bellow.
actionSanitizerFunction which takes action object and id number as arguments, and should return action object back. See the example bellow.
stateSanitizerFunction which takes state object and index as arguments, and should return state object back. See the example bellow.
startOnString or Array of strings indicating an action or a list of actions, which should start remote monitoring (when realtime is false).
stopOnString or Array of strings indicating an action or a list of actions, which should stop remote monitoring.
sendOnString or Array of strings indicating an action or a list of actions, which should trigger sending the history to the monitor (without starting it). Note: when using it, add a fetch polyfill if needed.
sendOnErrorNumeric code: 0 - disabled (default), 1 - send all uncaught exception messages, 2 - send only reducers error messages.
sendToString url of the monitor to send the history when sendOn is triggered. By default is ${secure ? 'https' : 'http'}://${hostname}:${port}.
actionCreatorsArray or Object of action creators to dispatch remotely. See the example.
shouldHotReloadBoolean - if set to false, will not recompute the states on hot reloading (or on replacing the reducers). Default to true.
idString to identify the instance when sending the history triggered by sendOn. You can use, for example, user id here, to know who sent the data.

All parameters are optional. You have to provide at least port property to use localhost instead of remotedev.io server.

Example:

export default function configureStore(initialState) {
  // Note: passing enhancer as last argument requires redux@>=3.1.0
  const store = createStore(
    rootReducer,
    initialState,
    devTools({
      name: 'Android app', realtime: true,
      hostname: 'localhost', port: 8000,
      maxAge: 30, filters: { blacklist: ['EFFECT_RESOLVED'] },
      actionSanitizer: (action) => (
       action.type === 'FILE_DOWNLOAD_SUCCESS' && action.data ?
       { ...action, data: '<<LONG_BLOB>>' } : action
      ),
      stateSanitizer: (state) => state.data ? { ...state, data: '<<LONG_BLOB>>' } : state
    })
  );
  // If you have other enhancers & middlewares
  // update the store after creating / changing to allow devTools to use them
  devTools.updateStore(store);
  return store;
}

Demo

Examples

License

MIT

Keywords

FAQs

Package last updated on 26 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc