peerlibrary / meteor-blaze-components

Reusable components for Blaze
http://components.meteorapp.com/
BSD 3-Clause "New" or "Revised" License
354 stars 26 forks source link

Extend data and currentData to return only a field and limit reactivity #101

Closed mitar closed 8 years ago

mitar commented 9 years ago

While using computed field to limit reactivity is cool it still becomes a bit tedious. So we extend data and currentData to return only requested field and limit reactivity to it. So something like:

@data 'foo.bar'

Would return the same as @data().foo.bar only that it would rerun only when the value changes. If foo or bar are functions, it would call them.

mitar commented 8 years ago

At the end implemented using data-lookup package. It limits the reactivity just to that field. You can specify the path with string with dots (foo.bar) or as an array (['foo', 'bar']).

mitar commented 8 years ago

currentData also checks the lexical scope: #76