by nathanhammond · 12y ago · 0 comments
In Ember that might look like this:
Ember.ArrayController.extend({
filterA: Ember.computed.filter('fieldName1', function comparator() {}),
filterB: Ember.computed.filter('fieldName2', function comparator() {}),
joined: Ember.computed.union('filterA', 'filterB'),
filtered: Ember.computed.uniq('joined'),
sorted: Ember.computed.sort(function comparator() {})
});If I wanted to add "roman" mythology to that filter I would imagine something like:
var mythologies = ["greek", "norse"];
// ... create a collection with filters
mythologies.push("roman");
PourOver.makeExactFilter("mythology", mythologies);
But you don't get that last statement for free, nor the one where you join it into a collection, nor do I see a way to replace the previous mythologies filter. Any time you need to reprocess a filter you've got to run it through a series of imperative actions triggered from one of the events, and possibly throw away the collection and regenerate it (if you can't remove disjoint filters).I would be pushing for a Object.observe/dirty checking/get-set version of this to take PourOver to the next level of utility. (?/Angular/Ember)