remote-redux-devtools
Advanced tools
Comparing version 0.4.9 to 0.5.0-alpha
@@ -5,5 +5,9 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = devTools; | ||
exports.preDevTools = preDevTools; | ||
exports.composeWithDevTools = composeWithDevTools; | ||
@@ -51,2 +55,3 @@ var _jsan = require('jsan'); | ||
var lastErrorMsg = void 0; | ||
var locked = void 0; | ||
var actionCreators = void 0; | ||
@@ -245,10 +250,10 @@ var stateSanitizer = void 0; | ||
if (checkForReducerErrors(liftedState)) return; | ||
if (lastAction === 'LOCK_CHANGES') { | ||
if (liftedState.dropNewActions === locked) return; | ||
locked = liftedState.dropNewActions; | ||
} | ||
var nextActionId = liftedState.nextActionId; | ||
var liftedAction = liftedState.actionsById[nextActionId - 1]; | ||
var action = liftedAction.action; | ||
if (action.type === '@@INIT') { | ||
relay('INIT', state, { timestamp: Date.now() }); | ||
} else if (lastAction === 'PERFORM_ACTION') { | ||
if (lastAction === 'PERFORM_ACTION') { | ||
var nextActionId = liftedState.nextActionId; | ||
var liftedAction = liftedState.actionsById[nextActionId - 1]; | ||
relay('ACTION', state, liftedAction, nextActionId); | ||
@@ -276,3 +281,7 @@ if (!isExcess && maxAge) isExcess = liftedState.stagedActionIds.length >= maxAge; | ||
return function (reducer, initialState) { | ||
store = (0, _configureStore2.default)(next, monitorReducer, { maxAge: maxAge, shouldCatchErrors: !!sendOnError })(reducer, initialState); | ||
store = (0, _configureStore2.default)(next, monitorReducer, { | ||
maxAge: maxAge, | ||
shouldCatchErrors: !!sendOnError, | ||
shouldHotReload: options.shouldHotReload | ||
})(reducer, initialState); | ||
@@ -288,4 +297,37 @@ if (realtime) start(); | ||
function preDevTools(createStore) { | ||
return function (reducer, preloadedState, enhancer) { | ||
store = createStore(reducer, preloadedState, enhancer); | ||
return _extends({}, store, { | ||
dispatch: function dispatch(action) { | ||
return locked ? action : store.dispatch(action); | ||
} | ||
}); | ||
}; | ||
} | ||
devTools.updateStore = function (newStore) { | ||
store = newStore; | ||
}; | ||
}; | ||
function composeWithDevTools() { | ||
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { | ||
funcs[_key] = arguments[_key]; | ||
} | ||
if (funcs.length === 0) { | ||
return devTools; | ||
} | ||
if (funcs.length === 1 && _typeof(funcs[0]) === 'object') { | ||
return devTools(funcs[0]); | ||
} | ||
return function (options) { | ||
return function () { | ||
return [preDevTools].concat(funcs).reduceRight(function (composed, f) { | ||
return f(composed); | ||
}, devTools(options).apply(undefined, arguments)); | ||
}; | ||
}; | ||
} |
'use strict'; | ||
module.exports = require('./devTools').default; | ||
exports.__esModule = true; | ||
exports.composeWithDevTools = exports.default = undefined; | ||
var _devTools = require('./devTools'); | ||
Object.defineProperty(exports, 'composeWithDevTools', { | ||
enumerable: true, | ||
get: function get() { | ||
return _devTools.composeWithDevTools; | ||
} | ||
}); | ||
var _devTools2 = _interopRequireDefault(_devTools); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _devTools2.default; |
{ | ||
"name": "remote-redux-devtools", | ||
"version": "0.4.9", | ||
"version": "0.5.0-alpha", | ||
"description": "Relay Redux actions to remote Redux DevTools.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -95,2 +95,3 @@ Remote Redux DevTools | ||
`actionCreators` | *Array* or *Object* of action creators to dispatch remotely. See [the example](https://github.com/zalmoxisus/remote-redux-devtools/commit/b54652930dfd4e057991df8471c343957fd7bff7). | ||
`shouldHotReload` | *Boolean* - if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Default to `true`. | ||
`id` | *String* 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. | ||
@@ -97,0 +98,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22257
322
135