Comparing version 5.0.3-1541966974774 to 5.0.3-1541977833440
@@ -101,12 +101,3 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
value: function onSubscription() { | ||
var _this2 = this; | ||
this.isDirty = true; | ||
this.subscribers.filter(function (subscriber) { | ||
return subscriber.watcher !== _this2; | ||
}).forEach(function (subscriber) { | ||
if (subscriber.watcher instanceof Compute) { | ||
subscriber.watcher.onSubscription(); | ||
} | ||
}); | ||
} | ||
@@ -116,3 +107,3 @@ }, { | ||
value: function compute() { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -126,3 +117,3 @@ this.executedCount++; | ||
}).map(function (computed) { | ||
return computed.subscribe(_this3, _this3.onSubscription); | ||
return computed.subscribe(_this2, _this2.onSubscription); | ||
}); | ||
@@ -147,3 +138,3 @@ } | ||
value: function parseDependencies(tag) { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -157,7 +148,7 @@ if (!(tag instanceof Tag)) { | ||
if (tag.type === 'props') { | ||
_this4.propsTags.push(tag); | ||
} else if (tag.type === 'state' && isComputedValue(tag.getValue(_this4.getters))) { | ||
_this4.computedTags.push(tag); | ||
_this3.propsTags.push(tag); | ||
} else if (tag.type === 'state' && isComputedValue(tag.getValue(_this3.getters))) { | ||
_this3.computedTags.push(tag); | ||
} else { | ||
_this4.stateTags.push(tag); | ||
_this3.stateTags.push(tag); | ||
} | ||
@@ -187,3 +178,3 @@ }); | ||
value: function hasChangedProps(props) { | ||
var _this5 = this; | ||
var _this4 = this; | ||
@@ -197,3 +188,3 @@ var nextGetters = this.controller.createContext(props); | ||
return tag.getValue(_this5.getters) !== tag.getValue(nextGetters); | ||
return tag.getValue(_this4.getters) !== tag.getValue(nextGetters); | ||
}, false); | ||
@@ -200,0 +191,0 @@ } |
@@ -63,3 +63,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; }; }(); | ||
_this.version = "5.0.3-1541966974774"; | ||
_this.version = "5.0.3-1541977833440"; | ||
_this.debuggerWatchMap = {}; | ||
@@ -66,0 +66,0 @@ _this.debuggerComputedMap = {}; |
@@ -197,6 +197,14 @@ 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; }; }(); | ||
computed[key] = { | ||
computed: attachedComputed, | ||
unsubscribe: attachedComputed.subscribe(_this5, _this5.updateComponent) | ||
var subscribeUp = function subscribeUp(computedInstance) { | ||
computedInstance.getValue(props); | ||
computed[key] = { | ||
computed: computedInstance, | ||
unsubscribe: computedInstance.subscribe(_this5, _this5.updateComponent) | ||
}; | ||
if (computedInstance.computedTags) computedInstance.computedTags.map(function (tag) { | ||
return tag.getValue(getters); | ||
}).forEach(subscribeUp); | ||
}; | ||
subscribeUp(attachedComputed); | ||
} | ||
@@ -203,0 +211,0 @@ |
@@ -58,2 +58,8 @@ 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; }; }(); | ||
for (var x = 0; x < this.subscribers.length; x++) { | ||
if (this.subscribers[x].watcher === watcher) { | ||
return; | ||
} | ||
} | ||
var subscription = { | ||
@@ -60,0 +66,0 @@ unsubscribe: function unsubscribe() { |
@@ -114,12 +114,3 @@ 'use strict'; | ||
value: function onSubscription() { | ||
var _this2 = this; | ||
this.isDirty = true; | ||
this.subscribers.filter(function (subscriber) { | ||
return subscriber.watcher !== _this2; | ||
}).forEach(function (subscriber) { | ||
if (subscriber.watcher instanceof Compute) { | ||
subscriber.watcher.onSubscription(); | ||
} | ||
}); | ||
} | ||
@@ -129,3 +120,3 @@ }, { | ||
value: function compute() { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -139,3 +130,3 @@ this.executedCount++; | ||
}).map(function (computed) { | ||
return computed.subscribe(_this3, _this3.onSubscription); | ||
return computed.subscribe(_this2, _this2.onSubscription); | ||
}); | ||
@@ -160,3 +151,3 @@ } | ||
value: function parseDependencies(tag) { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -170,7 +161,7 @@ if (!(tag instanceof _functionTree.Tag)) { | ||
if (tag.type === 'props') { | ||
_this4.propsTags.push(tag); | ||
} else if (tag.type === 'state' && (0, _utils.isComputedValue)(tag.getValue(_this4.getters))) { | ||
_this4.computedTags.push(tag); | ||
_this3.propsTags.push(tag); | ||
} else if (tag.type === 'state' && (0, _utils.isComputedValue)(tag.getValue(_this3.getters))) { | ||
_this3.computedTags.push(tag); | ||
} else { | ||
_this4.stateTags.push(tag); | ||
_this3.stateTags.push(tag); | ||
} | ||
@@ -200,3 +191,3 @@ }); | ||
value: function hasChangedProps(props) { | ||
var _this5 = this; | ||
var _this4 = this; | ||
@@ -210,3 +201,3 @@ var nextGetters = this.controller.createContext(props); | ||
return tag.getValue(_this5.getters) !== tag.getValue(nextGetters); | ||
return tag.getValue(_this4.getters) !== tag.getValue(nextGetters); | ||
}, false); | ||
@@ -213,0 +204,0 @@ } |
@@ -81,3 +81,3 @@ 'use strict'; | ||
_this.version = "5.0.3-1541966974774"; | ||
_this.version = "5.0.3-1541977833440"; | ||
_this.debuggerWatchMap = {}; | ||
@@ -84,0 +84,0 @@ _this.debuggerComputedMap = {}; |
@@ -211,6 +211,14 @@ 'use strict'; | ||
computed[key] = { | ||
computed: attachedComputed, | ||
unsubscribe: attachedComputed.subscribe(_this5, _this5.updateComponent) | ||
var subscribeUp = function subscribeUp(computedInstance) { | ||
computedInstance.getValue(props); | ||
computed[key] = { | ||
computed: computedInstance, | ||
unsubscribe: computedInstance.subscribe(_this5, _this5.updateComponent) | ||
}; | ||
if (computedInstance.computedTags) computedInstance.computedTags.map(function (tag) { | ||
return tag.getValue(getters); | ||
}).forEach(subscribeUp); | ||
}; | ||
subscribeUp(attachedComputed); | ||
} | ||
@@ -217,0 +225,0 @@ |
@@ -64,2 +64,8 @@ 'use strict'; | ||
for (var x = 0; x < this.subscribers.length; x++) { | ||
if (this.subscribers[x].watcher === watcher) { | ||
return; | ||
} | ||
} | ||
var subscription = { | ||
@@ -66,0 +72,0 @@ unsubscribe: function unsubscribe() { |
{ | ||
"name": "cerebral", | ||
"version": "5.0.3-1541966974774", | ||
"version": "5.0.3-1541977833440", | ||
"description": "A state controller with its own debugger", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"es6-error": "^4.0.2", | ||
"function-tree": "^3.3.1-1541966974774" | ||
"function-tree": "^3.3.1-1541977833440" | ||
}, | ||
@@ -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
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
799433
8015