The basic object, created with no prototype, causes problems for Polymer.
So, we need at least the basic Object prototype.
But adding additional properties to the prototype won’t transfer to the web component.
So that leaves configurable, writable, enumerable,
the Object methods: freeze, seal, and preventExtensions,
and getters and setters.
writable seems to be the most generally helpful option. Since Polymer’s
web components keep references to objects in their registration, this
technique could help prevent certain properties from changing.
In Polymer, properties don’t delete and configurable can’t change that.
The most pressing use for enumerable seems to be the use of
which allow for some extending of common objects. Marking something as
non-enumerable means it won’t get mixed-in.
Object.preventExtensions works and could be a great help in preventing
unwanted additions to an element’s model.
Object.freeze and Object.seal throw a Uncaught NoModificationAllowedError. This
probably has something to do with the way properties get copied, not unlike why delete
fails with generic objects.
Getters and setters sort of work. In the example below, you see the
right fullName but if you change either name using the input field,
the echo message won’t update even though the first and last names updated
on the model. However, if you uncomment the lines where we bind to first
and last name, it works as expected.
This means that using a setter circumvents Polymer’s observance of the model
change and, as a result, you probably want to avoid setters for now.