| 175 | // we need a closure so that the called function can remember the proper filter function to use, so function gets defined here |
| 176 | var self = this; |
| 177 | function onMapStoreTrigger(obj) { |
| 178 | // get an object |
| 179 | var update = filterFunc.call(self, obj); |
| 180 | // if no object returned from filter functions do nothing |
| 181 | if (!update) { |
| 182 | return; |
| 183 | } |
| 184 | // check if the update actually has any mapped props |
| 185 | /*jshint unused: false */ |
| 186 | var hasProps = false; |
| 187 | for (var check in update) { |
| 188 | hasProps = true; |
| 189 | break; |
| 190 | } |
| 191 | // if there were props mapped, then update via setState |
| 192 | if (hasProps) { |
| 193 | self.setState(update); |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // add the listener to know when the store is triggered |
| 198 | this.__storeunsubscribes__ = this.__storeunsubscribes__ || []; |