remote-redux-devtools
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -30,2 +30,3 @@ 'use strict'; | ||
var isExcess = void 0; | ||
var isMonitored = void 0; | ||
@@ -51,2 +52,21 @@ function isFiltered(action) { | ||
function filterStagedActions(state) { | ||
if (!filters) return state; | ||
var filteredStagedActionIds = []; | ||
var filteredComputedStates = []; | ||
state.stagedActionIds.forEach(function (id, idx) { | ||
if (!isFiltered(state.actionsById[id])) { | ||
filteredStagedActionIds.push(id); | ||
filteredComputedStates.push(state.computedStates[idx]); | ||
} | ||
}); | ||
return _extends({}, state, { | ||
stagedActionIds: filteredStagedActionIds, | ||
computedStates: filteredComputedStates | ||
}); | ||
} | ||
function handleMessages(message) { | ||
@@ -58,3 +78,3 @@ if (message.type === 'ACTION') { | ||
} else if (message.type === 'UPDATE') { | ||
relay('STATE', store.liftedStore.getState()); | ||
relay('STATE', filterStagedActions(store.liftedStore.getState())); | ||
} else if (message.type === 'SYNC') { | ||
@@ -66,2 +86,7 @@ if (socket.id && message.id !== socket.id) { | ||
} | ||
} else if (message.type === 'START') { | ||
isMonitored = true; | ||
} else if (message.type === 'STOP' || message.type === 'DISCONNECTED') { | ||
isMonitored = false; | ||
relay('STOP'); | ||
} | ||
@@ -105,21 +130,2 @@ } | ||
function filterStagedActions(state) { | ||
if (!filters) return state; | ||
var filteredStagedActionIds = []; | ||
var filteredComputedStates = []; | ||
state.stagedActionIds.forEach(function (id, idx) { | ||
if (!isFiltered(state.actionsById[id])) { | ||
filteredStagedActionIds.push(id); | ||
filteredComputedStates.push(state.computedStates[idx]); | ||
} | ||
}); | ||
return _extends({}, state, { | ||
stagedActionIds: filteredStagedActionIds, | ||
computedStates: filteredComputedStates | ||
}); | ||
} | ||
function handleChange(state, liftedState, maxAge) { | ||
@@ -147,3 +153,3 @@ var nextActionId = liftedState.nextActionId; | ||
store.subscribe(function () { | ||
handleChange(store.getState(), store.liftedStore.getState(), maxAge); | ||
if (isMonitored) handleChange(store.getState(), store.liftedStore.getState(), maxAge); | ||
}); | ||
@@ -150,0 +156,0 @@ return store; |
{ | ||
"name": "remote-redux-devtools", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"description": "Relay Redux actions to remote Redux DevTools.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
12183
146