Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cerebral

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral - npm Package Compare versions

Comparing version 0.21.0 to 0.22.0

2

package.json
{
"name": "cerebral",
"version": "0.21.0",
"version": "0.22.0",
"description": "A state controller with its own debugger",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -33,2 +33,12 @@ var utils = require('./utils.js');

if (
utils.isDeveloping() &&
!signalStore.isRemembering() &&
signalStore.getCurrentIndex() !== -1 &&
signalStore.getCurrentIndex() < signalStore.getSignals().length - 1
) {
console.warn('Cerebral - Looking in the past, ignored signal ' + signalName);
return;
}
var tree = staticTree(signalChain.chain);

@@ -35,0 +45,0 @@ var actions = tree.actions;

@@ -36,29 +36,20 @@ /*

currentIndex++;
if (utils.isDeveloping()) {
currentIndex++;
// When executing signals in EventStore, do not add them again
if (isRemembering) {
return;
}
// When executing signals in EventStore, do not add them again
if (isRemembering) {
return;
}
// If we are not keeping the state around reset the signals to just
// keep the latest one
/* ALWAYS KEEP STATE
if (!willKeepState) {
signals = [];
currentIndex = 0;
}
*/
// If we have travelled back and start adding new signals the signals not triggered should
// be removed. This effectively "changes history"
if (currentIndex < signals.length) {
signals.splice(currentIndex, signals.length - currentIndex);
}
// If we have travelled back and start adding new signals the signals not triggered should
// be removed. This effectively "changes history"
if (currentIndex < signals.length) {
signals.splice(currentIndex, signals.length - currentIndex);
// Add signal and set the current signal to be the recently added signal
signals.push(signal);
}
//signal.index = signals.length;
// Add signal and set the current signal to be the recently added signal
signals.push(signal);
},

@@ -65,0 +56,0 @@

@@ -6,2 +6,3 @@ var utils = require('./utils.js');

var isInitialized = false;
var disableDebugger = false;

@@ -12,2 +13,3 @@ var getDetail = function () {

willKeepState: signalStore.willKeepState(),
disableDebugger: disableDebugger,
currentSignalIndex: signalStore.getCurrentIndex(),

@@ -21,2 +23,7 @@ isExecutingAsync: signalStore.isExecutingAsync(),

var update = utils.debounce(function () {
if (disableDebugger) {
return;
}
var event = new CustomEvent('cerebral.dev.update', {

@@ -34,2 +41,5 @@ detail: getDetail()

disableDebugger = utils.hasLocalStorage() && localStorage.getItem('cerebral_disable_debugger') ?
JSON.parse(localStorage.getItem('cerebral_disable_debugger')) : false;
var signals = utils.hasLocalStorage() && localStorage.getItem('cerebral_signals') ?

@@ -84,2 +94,10 @@ JSON.parse(localStorage.getItem('cerebral_signals')) : [];

window.addEventListener('cerebral.dev.toggleDisableDebugger', function () {
disableDebugger = !disableDebugger;
var event = new CustomEvent('cerebral.dev.update', {
detail: getDetail()
});
window.dispatchEvent(event);
});
window.addEventListener('cerebral.dev.resetStore', function () {

@@ -117,2 +135,3 @@ signalStore.reset();

utils.hasLocalStorage() && localStorage.setItem('cerebral_willKeepState', isInitialized && JSON.stringify(signalStore.willKeepState()));
utils.hasLocalStorage() && localStorage.setItem('cerebral_disable_debugger', isInitialized && JSON.stringify(disableDebugger));
});

@@ -119,0 +138,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc