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

cerebral

Package Overview
Dependencies
Maintainers
5
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 5.0.0-1526334609969 to 5.0.0-1526409797341

2

es/Computed.js

@@ -66,3 +66,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

value: function clone() {
return new Computed(this.dependencies, this.computedCallback).create(this.controller, this.modulePath, this.name);
return new Computed(this.dependencies, this.computedCallback).create(this.controller, this.modulePath, this.name + ' (clone)');
}

@@ -69,0 +69,0 @@ }, {

@@ -14,3 +14,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

/* global WebSocket File FileList Blob ImageData VERSION */
import { delay } from '../utils';
import { debounce } from '../utils';
import { DevtoolsBase } from 'function-tree/devtools';

@@ -51,3 +51,5 @@ import { Computed } from '../Computed';

_ref$allowedTypes = _ref.allowedTypes,
allowedTypes = _ref$allowedTypes === undefined ? [] : _ref$allowedTypes;
allowedTypes = _ref$allowedTypes === undefined ? [] : _ref$allowedTypes,
_ref$disableDebounce = _ref.disableDebounce,
disableDebounce = _ref$disableDebounce === undefined ? false : _ref$disableDebounce;

@@ -63,3 +65,3 @@ _classCallCheck(this, Devtools);

_this.version = "5.0.0-1526334609969";
_this.version = "5.0.0-1526409797341";
_this.debuggerWatchMap = {};

@@ -78,6 +80,14 @@ _this.debuggerComputedMap = {};

_this.isResettingDebugger = false;
_this.pendingUpdates = [];
_this.allowedTypes = [].concat(typeof File === 'undefined' ? [] : File).concat(typeof FileList === 'undefined' ? [] : FileList).concat(typeof Blob === 'undefined' ? [] : Blob).concat(typeof ImageData === 'undefined' ? [] : ImageData).concat(typeof RegExp === 'undefined' ? [] : RegExp).concat(allowedTypes || []);
_this.sendInitial = _this.sendInitial.bind(_this);
_this.sendComponentsMap = delay(_this.sendComponentsMap, 50);
if (disableDebounce) {
var _ret;
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
_this.sendWatchMapBatch = debounce(_this.sendWatchMapBatch, 50);
return _this;

@@ -230,5 +240,3 @@ }

computedMap: this.debuggerComputedMap,
updates: {
ids: []
}
updates: []
}

@@ -334,21 +342,26 @@ }));

if (this.isConnected) {
this.sendMessage(JSON.stringify({
type: 'watchMap',
source: 'c',
version: this.version,
data: {
watchMap: this.debuggerWatchMap,
computedMap: this.debuggerComputedMap,
updates: {
start: start,
duration: duration,
changes: changes,
ids: watchUpdates.map(function (watch) {
return watch.id;
})
}
}
}));
this.pendingUpdates.push({
start: start,
duration: duration,
changes: changes,
watchers: watchUpdates
});
this.sendWatchMapBatch();
}
}
}, {
key: 'sendWatchMapBatch',
value: function sendWatchMapBatch() {
this.sendMessage(JSON.stringify({
type: 'watchMap',
source: 'c',
version: this.version,
data: {
watchMap: this.debuggerWatchMap,
computedMap: this.debuggerComputedMap,
updates: this.pendingUpdates
}
}));
this.pendingUpdates = [];
}
}]);

@@ -355,0 +368,0 @@

@@ -78,14 +78,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

export function delay(func, wait) {
export function debounce(func, wait, immediate) {
var timeout = void 0;
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var context = this;
var args = arguments;
var later = function later() {
func.apply(context, args);
timeout = null;
if (!immediate) func.apply(context, args);
};
setTimeout(later, wait);
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};

@@ -204,4 +205,4 @@ }

for (var _len2 = arguments.length, types = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
types[_key2 - 1] = arguments[_key2];
for (var _len = arguments.length, types = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
types[_key - 1] = arguments[_key];
}

@@ -208,0 +209,0 @@

@@ -214,4 +214,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

this.dynamicDependencies = [];
this.dynamicComputed.forEach(function (computed) {
return computed.destroy();
this.dynamicComputed.forEach(function (unsubscribe) {
return unsubscribe();
});

@@ -221,6 +221,10 @@ this.dynamicComputed = [];

if (tag.type === 'computed') {
var computed = tag.getValue(getters).clone();
computed.subscribe(_this6, _this6.updateComponent);
_this6.dynamicComputed.push(computed);
return computed.getValue(props);
var computedInstance = tag.getValue(getters);
var attachedComputed = computedInstance.propsTags.length ? computedInstance.clone() : computedInstance;
var unsubscribe = attachedComputed.subscribe(_this6, _this6.updateComponent);
_this6.dynamicComputed.push(computedInstance.propsTags.length ? function () {
return attachedComputed.destroy();
} : unsubscribe);
return attachedComputed.getValue(props);
}

@@ -227,0 +231,0 @@

@@ -79,3 +79,3 @@ 'use strict';

value: function clone() {
return new Computed(this.dependencies, this.computedCallback).create(this.controller, this.modulePath, this.name);
return new Computed(this.dependencies, this.computedCallback).create(this.controller, this.modulePath, this.name + ' (clone)');
}

@@ -82,0 +82,0 @@ }, {

@@ -68,3 +68,5 @@ 'use strict';

_ref$allowedTypes = _ref.allowedTypes,
allowedTypes = _ref$allowedTypes === undefined ? [] : _ref$allowedTypes;
allowedTypes = _ref$allowedTypes === undefined ? [] : _ref$allowedTypes,
_ref$disableDebounce = _ref.disableDebounce,
disableDebounce = _ref$disableDebounce === undefined ? false : _ref$disableDebounce;

@@ -80,3 +82,3 @@ _classCallCheck(this, Devtools);

_this.version = "5.0.0-1526334609969";
_this.version = "5.0.0-1526409797341";
_this.debuggerWatchMap = {};

@@ -95,6 +97,14 @@ _this.debuggerComputedMap = {};

_this.isResettingDebugger = false;
_this.pendingUpdates = [];
_this.allowedTypes = [].concat(typeof File === 'undefined' ? [] : File).concat(typeof FileList === 'undefined' ? [] : FileList).concat(typeof Blob === 'undefined' ? [] : Blob).concat(typeof ImageData === 'undefined' ? [] : ImageData).concat(typeof RegExp === 'undefined' ? [] : RegExp).concat(allowedTypes || []);
_this.sendInitial = _this.sendInitial.bind(_this);
_this.sendComponentsMap = (0, _utils.delay)(_this.sendComponentsMap, 50);
if (disableDebounce) {
var _ret;
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
_this.sendWatchMapBatch = (0, _utils.debounce)(_this.sendWatchMapBatch, 50);
return _this;

@@ -247,5 +257,3 @@ }

computedMap: this.debuggerComputedMap,
updates: {
ids: []
}
updates: []
}

@@ -351,21 +359,26 @@ }));

if (this.isConnected) {
this.sendMessage(JSON.stringify({
type: 'watchMap',
source: 'c',
version: this.version,
data: {
watchMap: this.debuggerWatchMap,
computedMap: this.debuggerComputedMap,
updates: {
start: start,
duration: duration,
changes: changes,
ids: watchUpdates.map(function (watch) {
return watch.id;
})
}
}
}));
this.pendingUpdates.push({
start: start,
duration: duration,
changes: changes,
watchers: watchUpdates
});
this.sendWatchMapBatch();
}
}
}, {
key: 'sendWatchMapBatch',
value: function sendWatchMapBatch() {
this.sendMessage(JSON.stringify({
type: 'watchMap',
source: 'c',
version: this.version,
data: {
watchMap: this.debuggerWatchMap,
computedMap: this.debuggerComputedMap,
updates: this.pendingUpdates
}
}));
this.pendingUpdates = [];
}
}]);

@@ -372,0 +385,0 @@

@@ -18,3 +18,3 @@ 'use strict';

exports.isDeveloping = isDeveloping;
exports.delay = delay;
exports.debounce = debounce;
exports.forceSerializable = forceSerializable;

@@ -110,14 +110,15 @@ exports.getProviders = getProviders;

function delay(func, wait) {
function debounce(func, wait, immediate) {
var timeout = void 0;
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var context = this;
var args = arguments;
var later = function later() {
func.apply(context, args);
timeout = null;
if (!immediate) func.apply(context, args);
};
setTimeout(later, wait);
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};

@@ -236,4 +237,4 @@ }

for (var _len2 = arguments.length, types = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
types[_key2 - 1] = arguments[_key2];
for (var _len = arguments.length, types = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
types[_key - 1] = arguments[_key];
}

@@ -240,0 +241,0 @@

@@ -229,4 +229,4 @@ 'use strict';

this.dynamicDependencies = [];
this.dynamicComputed.forEach(function (computed) {
return computed.destroy();
this.dynamicComputed.forEach(function (unsubscribe) {
return unsubscribe();
});

@@ -236,6 +236,10 @@ this.dynamicComputed = [];

if (tag.type === 'computed') {
var computed = tag.getValue(getters).clone();
computed.subscribe(_this6, _this6.updateComponent);
_this6.dynamicComputed.push(computed);
return computed.getValue(props);
var computedInstance = tag.getValue(getters);
var attachedComputed = computedInstance.propsTags.length ? computedInstance.clone() : computedInstance;
var unsubscribe = attachedComputed.subscribe(_this6, _this6.updateComponent);
_this6.dynamicComputed.push(computedInstance.propsTags.length ? function () {
return attachedComputed.destroy();
} : unsubscribe);
return attachedComputed.getValue(props);
}

@@ -242,0 +246,0 @@

{
"name": "cerebral",
"version": "5.0.0-1526334609969",
"version": "5.0.0-1526409797341",
"description": "A state controller with its own debugger",

@@ -24,3 +24,3 @@ "main": "index.js",

"es6-error": "^4.0.2",
"function-tree": "^3.3.0-1526334609969"
"function-tree": "^3.3.0-1526409797341"
},

@@ -27,0 +27,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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