function createDevTools(children) { var _class, _temp; var monitorElement = _react.Children.only(children); var monitorProps = monitorElement.props; var Monitor = monitorElement.type; var ConnectedMonitor = (0, _reactRedux.connect)(function (state) { return state; })(Monitor); return _temp = _class = function (_Component) { _inherits(DevTools, _Component); function DevTools(props, context) { _classCallCheck(this, DevTools); var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); if (!props.store && !context.store) { console.error('Redux DevTools could not render. You must pass the Redux store ' + 'to <DevTools> either as a "store" prop or by wrapping it in a ' + '<Provider store={store}>.'); return _possibleConstructorReturn(_this); } if (context.store) { _this.liftedStore = context.store.liftedStore; } else { _this.liftedStore = props.store.liftedStore; } if (!_this.liftedStore) { console.error('Redux DevTools could not render. Did you forget to include ' + 'DevTools.instrument() in your store enhancer chain before ' + 'using createStore()?'); } return _this; } DevTools.prototype.render = function render() { if (!this.liftedStore) { return null; } return _react2.default.createElement(ConnectedMonitor, _extends({}, monitorProps, { store: this.liftedStore })); }; return DevTools; }(_react.Component), _class.contextTypes = { store: _react.PropTypes.object }, _class.propTypes = { store: _react.PropTypes.object }, _class.instrument = function (options) { return (0, _reduxDevtoolsInstrument2.default)(function (state, action) { return Monitor.update(monitorProps, state, action); }, options); }, _temp; }
n/a
function instrument() {
var monitorReducer = arguments.length <= 0 || arguments[0] === undefined ? function () {
return null;
} : arguments[0];
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
/* eslint-disable no-eq-null */
if (options.maxAge != null && options.maxAge < 2) {
/* eslint-enable */
throw new Error('DevTools.instrument({ maxAge }) option, if specified, ' + 'may not be less than 2.');
}
return function (createStore) {
return function (reducer, initialState, enhancer) {
function liftReducer(r) {
if (typeof r !== 'function') {
if (r && typeof r.default === 'function') {
throw new Error('Expected the reducer to be a function. ' + 'Instead got an object with a "default" field. ' + 'Did
you pass a module instead of the default export? ' + 'Try passing require(...).default instead.');
}
throw new Error('Expected the reducer to be a function.');
}
return liftReducerWith(r, initialState, monitorReducer, options);
}
var liftedStore = createStore(liftReducer(reducer), enhancer);
if (liftedStore.liftedStore) {
throw new Error('DevTools instrumentation should not be applied more than once. ' + 'Check your store configuration.');
}
return unliftStore(liftedStore, liftReducer);
};
};
}
...
if (context.store) {
_this.liftedStore = context.store.liftedStore;
} else {
_this.liftedStore = props.store.liftedStore;
}
if (!_this.liftedStore) {
console.error('Redux DevTools could not render. Did you forget to include ' + 'DevTools.instrument() in your store enhancer chain before ' + 'using createStore()?');
}
return _this;
}
DevTools.prototype.render = function render() {
if (!this.liftedStore) {
return null;
...
function persistState(sessionId) { var deserializeState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _identity2.default; var deserializeAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _identity2.default; if (!sessionId) { return function (next) { return function () { return next.apply(undefined, arguments); }; }; } function deserialize(state) { return _extends({}, state, { actionsById: (0, _mapValues2.default)(state.actionsById, function (liftedAction) { return _extends({}, liftedAction, { action: deserializeAction(liftedAction.action) }); }), committedState: deserializeState(state.committedState), computedStates: state.computedStates.map(function (computedState) { return _extends({}, computedState, { state: deserializeState(computedState.state) }); }) }); } return function (next) { return function (reducer, initialState, enhancer) { var key = 'redux-dev-session-' + sessionId; var finalInitialState = void 0; try { var json = localStorage.getItem(key); if (json) { finalInitialState = deserialize(JSON.parse(json)) || initialState; next(reducer, initialState); } } catch (e) { console.warn('Could not read debug session from localStorage:', e); try { localStorage.removeItem(key); } finally { finalInitialState = undefined; } } var store = next(reducer, finalInitialState, enhancer); return _extends({}, store, { dispatch: function dispatch(action) { store.dispatch(action); try { localStorage.setItem(key, JSON.stringify(store.getState())); } catch (e) { console.warn('Could not write debug session to localStorage:', e); } return action; } }); }; }; }
n/a
function commit() { return { type: ActionTypes.COMMIT, timestamp: Date.now() }; }
n/a
function importState(nextLiftedState, noRecompute) { return { type: ActionTypes.IMPORT_STATE, nextLiftedState: nextLiftedState, noRecompute: noRecompute }; }
n/a
function jumpToAction(actionId) { return { type: ActionTypes.JUMP_TO_ACTION, actionId: actionId }; }
n/a
function jumpToState(index) { return { type: ActionTypes.JUMP_TO_STATE, index: index }; }
n/a
function lockChanges(status) { return { type: ActionTypes.LOCK_CHANGES, status: status }; }
n/a
function pauseRecording(status) { return { type: ActionTypes.PAUSE_RECORDING, status: status }; }
n/a
function performAction(action) { if (!(0, _isPlainObject2.default)(action)) { throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); } if (typeof action.type === 'undefined') { throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); } return { type: ActionTypes.PERFORM_ACTION, action: action, timestamp: Date.now() }; }
n/a
function reorderAction(actionId, beforeActionId) { return { type: ActionTypes.REORDER_ACTION, actionId: actionId, beforeActionId: beforeActionId }; }
n/a
function reset() { return { type: ActionTypes.RESET, timestamp: Date.now() }; }
n/a
function rollback() { return { type: ActionTypes.ROLLBACK, timestamp: Date.now() }; }
n/a
function setActionsActive(start, end) { var active = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2]; return { type: ActionTypes.SET_ACTIONS_ACTIVE, start: start, end: end, active: active }; }
n/a
function sweep() { return { type: ActionTypes.SWEEP }; }
n/a
function toggleAction(id) { return { type: ActionTypes.TOGGLE_ACTION, id: id }; }
n/a
function createDevTools(children) { var _class, _temp; var monitorElement = _react.Children.only(children); var monitorProps = monitorElement.props; var Monitor = monitorElement.type; var ConnectedMonitor = (0, _reactRedux.connect)(function (state) { return state; })(Monitor); return _temp = _class = function (_Component) { _inherits(DevTools, _Component); function DevTools(props, context) { _classCallCheck(this, DevTools); var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); if (!props.store && !context.store) { console.error('Redux DevTools could not render. You must pass the Redux store ' + 'to <DevTools> either as a "store" prop or by wrapping it in a ' + '<Provider store={store}>.'); return _possibleConstructorReturn(_this); } if (context.store) { _this.liftedStore = context.store.liftedStore; } else { _this.liftedStore = props.store.liftedStore; } if (!_this.liftedStore) { console.error('Redux DevTools could not render. Did you forget to include ' + 'DevTools.instrument() in your store enhancer chain before ' + 'using createStore()?'); } return _this; } DevTools.prototype.render = function render() { if (!this.liftedStore) { return null; } return _react2.default.createElement(ConnectedMonitor, _extends({}, monitorProps, { store: this.liftedStore })); }; return DevTools; }(_react.Component), _class.contextTypes = { store: _react.PropTypes.object }, _class.propTypes = { store: _react.PropTypes.object }, _class.instrument = function (options) { return (0, _reduxDevtoolsInstrument2.default)(function (state, action) { return Monitor.update(monitorProps, state, action); }, options); }, _temp; }
n/a
function persistState(sessionId) { var deserializeState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _identity2.default; var deserializeAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _identity2.default; if (!sessionId) { return function (next) { return function () { return next.apply(undefined, arguments); }; }; } function deserialize(state) { return _extends({}, state, { actionsById: (0, _mapValues2.default)(state.actionsById, function (liftedAction) { return _extends({}, liftedAction, { action: deserializeAction(liftedAction.action) }); }), committedState: deserializeState(state.committedState), computedStates: state.computedStates.map(function (computedState) { return _extends({}, computedState, { state: deserializeState(computedState.state) }); }) }); } return function (next) { return function (reducer, initialState, enhancer) { var key = 'redux-dev-session-' + sessionId; var finalInitialState = void 0; try { var json = localStorage.getItem(key); if (json) { finalInitialState = deserialize(JSON.parse(json)) || initialState; next(reducer, initialState); } } catch (e) { console.warn('Could not read debug session from localStorage:', e); try { localStorage.removeItem(key); } finally { finalInitialState = undefined; } } var store = next(reducer, finalInitialState, enhancer); return _extends({}, store, { dispatch: function dispatch(action) { store.dispatch(action); try { localStorage.setItem(key, JSON.stringify(store.getState())); } catch (e) { console.warn('Could not write debug session to localStorage:', e); } return action; } }); }; }; }
n/a