diff --git a/lib/datadistributor.js b/lib/datadistributor.js index e19dc4c..67cf7eb 100644 --- a/lib/datadistributor.js +++ b/lib/datadistributor.js @@ -1,4 +1,4 @@ -define([], function () { +define(["filters/nodefilter"], function (NodeFilter) { return function () { var targets = [] var filterObservers = [] @@ -26,9 +26,13 @@ define([], function () { if (data === undefined) return - filteredData = filters.reduce( function (a, f) { - return f.run(a) - }, data) + var filter = filters.reduce( function (a, f) { + return function (d) { + return a(d) && f.run(d) + } + }, function () { return true }) + + filteredData = new NodeFilter(filter)(data) targets.forEach( function (t) { t.setData(filteredData) diff --git a/lib/filters/genericnode.js b/lib/filters/genericnode.js index 936e71d..4c2a09d 100644 --- a/lib/filters/genericnode.js +++ b/lib/filters/genericnode.js @@ -1,4 +1,4 @@ -define(["filters/nodefilter"], function (nodefilter) { +define([], function () { return function (name, key, value, f) { var negate = false var refresh @@ -44,7 +44,7 @@ define(["filters/nodefilter"], function (nodefilter) { } } - return { run: nodefilter(run), + return { run: run, setRefresh: setRefresh, render: render }