PolymerElements / app-localize-behavior

Polymer behaviour to help internationalize your application
48 stars 55 forks source link

2.0 preview with class expressions #70

Closed nadous closed 7 years ago

nadous commented 7 years ago

I was looking for a way to implement "behaviors" as mixins that return class expressions, as stated in the upgrade guide. There's a neat codelab here which provides the basic skeleton for a custom behavior. Since I'm new to Polymer, I have no reason to use Polymer.LegacyElement to patch v.1 design of older projects, so I decided to get acquainted with the train from the station I've found it. Since there's not a lot of resources on how we can upgrade the v.1 behavior design of existing elements, I've just PR this for feedback.

googlebot commented 7 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


nadous commented 7 years ago

I signed it!

googlebot commented 7 years ago

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

nadous commented 7 years ago

I signed it!

googlebot commented 7 years ago

CLAs look good, thanks!

notwaldorf commented 7 years ago

I think this would be a 3.0 element, not a 2.0, so it can't be merged in the 2.0 branch. The 2.0 versions are meant to be hybrid elements, that can work in apps that use either Polymer 1.0 or 2.0. (see https://www.polymer-project.org/1.0/blog/2016-09-09-polymer-2.0 for more details)

nadous commented 7 years ago

OK, I'm in the future!

observers: [
        //the observers you know and love from Polymer
      ]

I've missed that part... To sum up: if I have to build a custom element, I should implement the class-based design pattern, and if I use a Polymer 2.0-preview component, the backwards-compatible Polymer.Element will be just fine, right?

nadous commented 7 years ago

For a reason I ignore, last month commits in 2.0-preview has broken this anyway. The localize method becoming undefined within the mixin, I guess I'll wait that hybrid thing gets less schizophrenic.