-
Notifications
You must be signed in to change notification settings - Fork 54
adds ability to repeat over object keys #211
Conversation
also relates with Polymer/polymer#1062 |
@rafaelw PTAL |
// Use for template repeating objects | ||
function ObjectArrayProxy(values, observe, onAddedCallback, onRemovedCallback) { | ||
this.values = values; | ||
this.onAdded = onAddedCallback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this callback used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I will remove.
I added some comments. Overall it looks like it would work. One high level comment, did you consider a design that adds support to https://github.com/Polymer/polymer-expressions instead of TemplateBinding? I think the desire was to fix it at that layer (hence moving this issue googlearchive/polymer-expressions#11 to polymer-expressions) |
Best to change it in TemplateBinding because that is where we can determine if we have to observe and repeat an Object or an Array at runtime. I did want to make a change at PolymerExpressions as well so we can also use expressions like Using an ES6 map in this case wouldn't be possible as its implementation uses iterators to obtain the keys and values meaning we cant monitor keys or values being added or removed. If only there was an ES6 map observer or change callback. |
adds the following tests: Repeat If (Object Keys) Repeat If (false-true-false) Repeat If (false-true-false) (Object Keys) Repeat oneTime-If (predicate false) (Object Keys) Repeat oneTime-If (predicate true) (Object Keys) oneTime-Repeat If (Object Keys) oneTime-Repeat oneTime-If (Object Keys) Repeat (Object Keys) Repeat - oneTime (Object Keys)
@jmesserly squashed commits back to one. Added 7 more unit tests (cloned from existing tests and transformed to handle object keys) PTAL |
closed in favour of implementation in 0.8 Polymer/polymer#1385 |
relates with #116
relates with googlearchive/polymer-expressions#11
example syntax: