Comparing version 0.20.10 to 0.20.11
{ | ||
"name": "cerebral", | ||
"version": "0.20.10", | ||
"version": "0.20.11", | ||
"description": "A state controller with its own debugger", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -12,16 +12,4 @@ /* | ||
// We grab the signals stored in localStorage, if any | ||
var signals = utils.hasLocalStorage() && localStorage.getItem('cerebral_signals') ? | ||
JSON.parse(localStorage.getItem('cerebral_signals')) : []; | ||
// Indicates if signals should be stored or replaced. Grabs from localStorage if available | ||
var willKeepState = ( | ||
typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? | ||
false : | ||
utils.hasLocalStorage() && localStorage.getItem('cerebral_willKeepState') ? | ||
JSON.parse(localStorage.getItem('cerebral_willKeepState')) : | ||
true | ||
); | ||
var signals = []; | ||
var willKeepState = false; | ||
var executingAsyncActionsCount = 0; | ||
@@ -178,2 +166,6 @@ var isRemembering = false; | ||
setSignals: function (newSignals) { | ||
signals = signals.concat(newSignals); | ||
}, | ||
isExecutingAsync: function () { | ||
@@ -180,0 +172,0 @@ return !!executingAsyncActionsCount; |
@@ -33,2 +33,13 @@ var utils = require('./utils.js'); | ||
var signals = utils.hasLocalStorage() && localStorage.getItem('cerebral_signals') ? | ||
JSON.parse(localStorage.getItem('cerebral_signals')) : []; | ||
var willKeepState = utils.hasLocalStorage() && localStorage.getItem('cerebral_willKeepState') ? | ||
JSON.parse(localStorage.getItem('cerebral_willKeepState')) : | ||
true; | ||
if (willKeepState) { | ||
signalStore.toggleKeepState(); | ||
} | ||
isInitialized = true; | ||
@@ -42,2 +53,3 @@ | ||
}); | ||
signalStore.setSignals(signals); | ||
signalStore.remember(signalStore.getSignals().length - 1); | ||
@@ -50,2 +62,3 @@ window.dispatchEvent(event); | ||
}); | ||
signalStore.setSignals(signals); | ||
signalStore.rememberInitial(signalStore.getSignals().length - 1); | ||
@@ -99,3 +112,5 @@ window.dispatchEvent(event); | ||
window.addEventListener('unload', function () { | ||
signalStore.removeRunningSignals(); | ||
utils.hasLocalStorage() && localStorage.setItem('cerebral_signals', isInitialized && signalStore.willKeepState() ? JSON.stringify(signalStore.getSignals()) : JSON.stringify([])); | ||
@@ -102,0 +117,0 @@ utils.hasLocalStorage() && localStorage.setItem('cerebral_willKeepState', isInitialized && JSON.stringify(signalStore.willKeepState())); |
@@ -54,5 +54,3 @@ var CreateSignalFactory = require('./CreateSignalFactory.js'); | ||
controller.devtools.start(); | ||
return controller; | ||
}; |
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
2383377
28057
307