• Stars
    star
    327
  • Rank 128,686 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MobX DevTools extension

Mentioned in Awesome Mobx

Remote debugging for MobX with Redux DevTools extension (and remotedev coming soon)

Demo

Installation

1. Get the extension

1.1 For Chrome
1.2 For Firefox
1.3 For Electron
1.4 For other browsers, for React Native, hybrid, desktop and server side apps
  • Use remotedev.io or if you have the extension select Remote DevTools from the context menu. Just specify remote parameter, and optionally hostname and port. See the API for details.

2. Install the library

npm install --save mobx-remotedev

Usage

import remotedev from 'mobx-remotedev';
// or import remotedev from 'mobx-remotedev/lib/dev'
// in case you want to use it in production or don't have process.env.NODE_ENV === 'development'

const appStore = observable({
  // ...
});

// Or
class appStore {
  // ...
}

export default remotedev(appStore);

Or as ES decorator:

import remotedev from 'mobx-remotedev';

@remotedev(/*{ config }*/)
export default class appStore {
  // ...
}

See counter, simple-todo and todomvc examples.

API

remotedev(store, [config])

  • arguments
    • store observable or class to be monitored. In case you want to change its values (to time travel or cancel actions), you should export its result as in the example above (so we can extend the class).
    • config object (optional as the parameters bellow)
      • name string - the instance name to be showed on the monitor page. Default value is document.title.
      • onlyActions boolean - set it to true to have a clear log only with actions. If MobX is in strict mode, it is true by default. Don't forget about async actions.
      • global boolean - set it to true in order to assign dispatching of all unhandled actions to this store. Useful for nested classes / observables or when having async actions without specifying the scope explicitly.
      • filters object - map of arrays named whitelist or blacklist to filter action types. You can also set it globally in the extension settings.
        • blacklist array of (regex as string) - actions to be hidden in DevTools.
        • whitelist array of (regex as string) - all other actions will be hidden in DevTools (the blacklist parameter will be ignored).
      • remote boolean - set it to true to have remote monitoring via the local or remotedev.io server. remote: false is used for the extension or react-native-debugger
      • hostname string - use to specify host for remotedev-server. If port is specified, default value is localhost.
      • port number - use to specify host's port for remotedev-server.

Also see the extension API and my presentation at React Europe.

Exclude / include DevTools in production builds

By default use

import remotedev from 'mobx-remotedev';

It will work only when process.env.NODE_ENV === 'development', otherwise the code will be stripped.

In case you want to use it in production or cannot set process.env.NODE_ENV, use

import remotedev from 'mobx-remotedev/lib/dev';

So, the code will not be stripped from production bundle and you can use the extension even in production. It wouldn't affect the performance for end-users who don't have the extension installed.

FAQ

How to monitor (show changes) for inner items

Use remotedev function for them as well. Example

How to set data correctly when time traveling

By default it will try to set the properties of the class or observable object, but, if you have an importState method, it will be used. Example

How to disable computations when time traveling

Check __isRemotedevAction of your class or observable object, which will be set to true when it's a monitor action. Example

How to handle async actions

Use runInAction and don't forget about the second / third parameter which will be this if you're using arrow functions. If you don't want to specify it, set the global parameter to true. Example

How to show actions for nested classes / observables

Just set the global parameter to true like remotedev(store, { global: true }). If you want more details about the nested tree, see #5.

LICENSE

MIT

Created By

If you like this, follow @mdiordiev on twitter.

More Repositories

1

redux-devtools-extension

Redux DevTools extension.
JavaScript
13,500
star
2

remote-redux-devtools

Redux DevTools remotely.
JavaScript
1,804
star
3

crossbuilder

Building web, Electron, Cordova and Chrome apps, and cross-browser extensions with React, Redux and Webpack. "Write once, deploy everywhere" concept in practice.
JavaScript
483
star
4

redux-remotedev

Redux DevTools for production (web and React Native) with a highly flexible API.
JavaScript
267
star
5

remotedev-server

Connect Redux DevTools extension to a remote app.
JavaScript
183
star
6

remotedev-app

Remote Redux DevTools monitor app.
JavaScript
158
star
7

remotedev

Remote debugging for any flux architecture.
JavaScript
143
star
8

atom-redux-devtools

Redux DevTools Atom package
CoffeeScript
140
star
9

redux-devtools-filter-actions

Redux DevTools composable monitor with the ability to filter actions.
JavaScript
77
star
10

social-expert

Master your GitHub notifications by priority and weight.
JavaScript
59
star
11

redux-devtools-instrument

Redux DevTools instrumentation. Moved to redux-devtools monorepo.
JavaScript
41
star
12

remotedev-serialize

Serialize "unserializable" data and parse it back.
JavaScript
25
star
13

redux-notify

Notify when specified redux actions are dispatched.
JavaScript
17
star
14

devui

Reusable React components for building Redux Devtools monitors.
JavaScript
16
star
15

redux-devtools-test-generator

Generate tests right in Redux DevTools.
JavaScript
14
star
16

momentjs-datetimepicker

jQuery Date and Time Picker using Momentjs format and translations.
JavaScript
14
star
17

browser-redux-sync

Keep redux states in sync for browser extensions and apps.
JavaScript
13
star
18

react-chat

WIP
JavaScript
12
star
19

react-switcher

Stateless React switcher component to toggle container states.
JavaScript
7
star
20

crossmessaging

Crossextension messaging.
JavaScript
6
star
21

chrome-storage-local

Use the same api for chrome.storage.local as for localStorage.
JavaScript
5
star
22

horizon-remotedev

Horizon DevTools extension.
JavaScript
4
star
23

browser-redux-bg

Messaging library for Cross-browser extensions and Chrome apps.
JavaScript
3
star
24

remotedev-utils

Moved to https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-core
JavaScript
2
star
25

zalmoxisus.github.io

HTML
2
star
26

boilerplate

JavaScript
1
star
27

remotedev-slider

Redux DevTools Slider monitor with remote reports
JavaScript
1
star