ampersand-state
Advanced tools
Comparing version 4.3.10 to 4.3.11
@@ -663,3 +663,6 @@ var _ = require('underscore'); | ||
if (!isSame) { | ||
this.stopListening(currentVal); | ||
if (currentVal) { | ||
this.stopListening(currentVal); | ||
} | ||
if (newVal != null) { | ||
@@ -666,0 +669,0 @@ this.listenTo(newVal, 'all', this._getEventBubblingHandler(attributeName)); |
{ | ||
"name": "ampersand-state", | ||
"description": "An observable, extensible state object with derived watchable properties.", | ||
"version": "4.3.10", | ||
"version": "4.3.11", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -30,3 +30,3 @@ # ampersand-state | ||
To create a **State** class of your own, you extend **AmpersandState** and provide instance properties and options for your class. Typically here you will pass any properties (`props`, `session` and `derived` of your state class, and any instance methods to be attached to instances of your class. | ||
To create a **State** class of your own, you extend **AmpersandState** and provide instance properties and options for your class. Typically here you will pass any properties (`props`, `session` and `derived`) of your state class, and any instance methods to be attached to instances of your class. | ||
@@ -33,0 +33,0 @@ **extend** correctly sets up the prototype chain, so that subclasses created with **extend** can be further extended as many times as you like. |
@@ -1046,3 +1046,4 @@ var tape = require('tape'); | ||
props: { | ||
sub: 'state' | ||
sub: 'state', | ||
sub2: 'state' | ||
} | ||
@@ -1104,2 +1105,35 @@ }); | ||
test.only('Issue: #75 `state` property from undefined -> state', function (t) { | ||
t.plan(2); | ||
var Person = State.extend({ | ||
props: { | ||
sub: 'state', | ||
sub2: 'state' | ||
} | ||
}); | ||
var SubState = State.extend({ | ||
props: { | ||
foo: 'string' | ||
} | ||
}); | ||
var sub = new SubState({ foo: 'a' }); | ||
var p = new Person({ sub: sub }); | ||
p.on('change:sub.foo', function () { | ||
t.ok(true); | ||
}); | ||
sub.foo = 'b'; | ||
p.sub2 = new SubState({ foo: 'bar' }); | ||
sub.foo = 'c'; | ||
t.end(); | ||
}); | ||
test('`state` properties should invalidate dependent derived properties when changed', function (t) { | ||
@@ -1106,0 +1140,0 @@ var counter = 0; |
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
109512
2797