alamid-junction
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -171,3 +171,5 @@ "use strict"; | ||
}; | ||
signal(this._values[key]); | ||
if (this._values.hasOwnProperty(key)) { | ||
signal(this._values[key]); | ||
} | ||
signal.subscribe(function onSignalChange(newValue) { | ||
@@ -174,0 +176,0 @@ self._values[key] = self.setter(key, newValue); |
{ | ||
"name": "alamid-junction", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Provides convenient methods for setting and retrieving multiple signals", | ||
@@ -5,0 +5,0 @@ "main": "./lib/Junction.js", |
@@ -45,9 +45,11 @@ "use strict"; | ||
describe(".prototype", function () { | ||
var givenValue; | ||
function Signal() { | ||
var listener; | ||
var listener, | ||
givenValue; | ||
function signal(value) { | ||
if (arguments.length === 1) { | ||
if (signal.setter) { | ||
value = signal.setter(value); | ||
} | ||
givenValue = value; | ||
@@ -259,5 +261,7 @@ listener && listener(value); | ||
expect(greeting()).to.equal(34); | ||
expect(greeting()).to.equal("Ahoy!"); | ||
expect(age()).to.equal(34); | ||
junction.reset(); | ||
expect(greeting()).to.equal(undefined); | ||
expect(age()).to.equal(undefined); | ||
}); | ||
@@ -331,6 +335,14 @@ | ||
it("should return a signal representing the value specified by key", function () { | ||
var greeting = junction.signal("greeting"); | ||
var greeting, | ||
name; | ||
junction.set("name", "The mighty pirate"); | ||
name = junction.signal("name"); | ||
greeting = junction.signal("greeting"); | ||
expect(greeting()).to.equal(undefined); | ||
expect(name()).to.equal("The mighty pirate"); | ||
junction.set("greeting", "Ahoy!"); | ||
expect(greeting()).to.equal("Ahoy!"); | ||
@@ -337,0 +349,0 @@ expect(junction.get("greeting")).to.equal("Ahoy!"); |
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
22360
517