Through mixins or extensions, I mean, you write a base element class that
understands protobufs for example and mirrors their properties to proper
Polymer properties when they are assigned to your property. It won't be
pretty but, I can say, when I was at Google, we had no such convenience
with Protobufs and they were used quite a bit.

-Karl Tiedt

On Wed, Oct 25, 2017 at 12:35 PM, Red Daly <[email protected]> wrote:

> The use case is to support generated code from the protocol buffers
> library so that those objects can be used directly as property values.
> Protobuf objects use getFoo and setFoo style accessors. They are typically
> nested deeply and used for communication back and forth with the server.
> The idea is to use a protobuf object as the property value in my element
> and reference its numerous fields from the template without translating
> back and forth to an object with simple setters/getters.
>
> The myThing object in the demo is a stand-in for a protobuf object. Access
> in JavaScript should be through the getFoo syntax.
>
> What do you mean that this may be possible with a "code extension?" I'm
> happy to do this only in my own app through a mix-in, but I don't see how
> to accomplish that without an API for resolving paths.
>
>
> On Oct 25, 2017 7:44 AM, "Karl Tiedt" <[email protected]> wrote:
>
>> First off, I highly doubt an API change is gonna happen at this point to
>> support, yet another data access method, when you can most likely
>> accomplish it via code extensions or a base element class that enables this
>> feature in the elements that require it. Second off, I dont see anywhere in
>> your example you actually use this prescribed notion of setFoo, getFoo
>> other than extending the demo object to add those methods... Maybe I am
>> missing something (it is early for me)? It could simply be that I do not
>> see how you expect to leverage this since you don't appear to call any of
>> these proposed APIs in your plnkr... Trying ele.getName() fails,
>> ele.myThing.getName() works but ele.myThing.name does not...
>>
>> Can you more clearly elaborate on what your goal is here?
>>
>> -Karl Tiedt
>>
>> On Wed, Oct 25, 2017 at 1:00 AM, <[email protected]> wrote:
>>
>>> I'm using objects that only expose data through getFoo() and setFoo()
>>> methods. Would Polymer developers be supportive of amending Polymer to
>>> support this use case?
>>>
>>> (The objects in question are JavaScript protocol buffer messages.)
>>>
>>> From looking over lib/utils/path.html
>>> <https://github.com/Polymer/polymer/blob/0b23e746bf2232732a322b7614fd0dcf3a8b2a73/lib/utils/path.html#L210>,
>>> it seems fairly straightforward to hook into the path code. For an
>>> inelegant example, consider this plnkr
>>> <http://plnkr.co/edit/uv8EjdYLRqtU6nGOzVZm>.
>>>
>>> Follow Polymer on Google+: plus.google.com/107187849809354688692
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Polymer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/polymer-dev/0d0af3dc-f58d-4502-b6e8-f8c48c130ec8%40googlegroups.com
>>> <https://groups.google.com/d/msgid/polymer-dev/0d0af3dc-f58d-4502-b6e8-f8c48c130ec8%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CADNgbTGueHtoZ9qY3qWrj%2B9GeCMrcNteQpX5dXbedTU2VuvGfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to