reactive-function
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -124,4 +124,6 @@ var ReactiveProperty = require("reactive-property"); | ||
ReactiveFunction.digest = function (){ | ||
var changedIds = Object.keys(changed); | ||
changed = {}; | ||
graph | ||
.topologicalSort(Object.keys(changed), false) | ||
.topologicalSort(changedIds, false) | ||
.map(function (id){ | ||
@@ -133,3 +135,2 @@ return properties[id]; | ||
}); | ||
changed = {}; | ||
@@ -136,0 +137,0 @@ }; |
{ | ||
"name": "reactive-function", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "A library for managing data flows and changing state.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
35
test.js
@@ -23,3 +23,3 @@ // Unit tests for reactive-function. | ||
describe("Core Functionality", function() { | ||
describe("Core Functionality", function() { | ||
it("Should depend on two reactive properties.", function () { | ||
@@ -434,2 +434,33 @@ | ||
it("Should execute a nested digest.", function (){ | ||
var a = ReactiveProperty(5); | ||
var b = ReactiveProperty(); | ||
var c = ReactiveProperty(); | ||
var rf1 = ReactiveFunction({ | ||
inputs: [a], | ||
callback: function (a){ | ||
for(var i = 0; i < a; i++){ | ||
b(i); | ||
ReactiveFunction.digest(); | ||
assert.equal(c(), i / 2); | ||
} | ||
} | ||
}); | ||
var rf2 = ReactiveFunction({ | ||
inputs: [b], | ||
output: c, | ||
callback: function (b){ | ||
return b / 2; | ||
} | ||
}); | ||
ReactiveFunction.digest(); | ||
rf1.destroy(); | ||
rf2.destroy(); | ||
}); | ||
}); | ||
@@ -541,3 +572,3 @@ | ||
// Fix by changing the value of initialId. | ||
var initialId = 56; | ||
var initialId = 60; | ||
@@ -544,0 +575,0 @@ it("Should serialize the data flow graph.", function (){ |
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
39374
699