custom-elements-hmr-polyfill icon indicating copy to clipboard operation
custom-elements-hmr-polyfill copied to clipboard

Polymer decorators don't work well with the polyfill

Open danielvanmil opened this issue 4 years ago • 2 comments

To reproduce:

  • Implement a Polymer 3 element with Polymer decorators and a computed property, like:
class X extends PolymerElement {
    @decorators.property({ notify: true, reflectToAttribute: true, computed: "getP1()", type: String })
    p1: string = null;

    getP1(): string {
        return 'second string';
    }

static get template(): HTMLTemplateElement {
        return html`p1: [[p1]]`;
}

The computed property is not computed with the polyfill, without it is.

Any idea?

danielvanmil avatar Jan 18 '21 17:01 danielvanmil

Never used polymer 3. Any reason why you dont use lit-element or something newer? Noticed this:

image

But basically Ive noticed some issues with some libs if they do to much fancy stuff. Added some points under readme under Limitations I know about atm. Might be the issue I have with observeredAttributes,, some libs do not like what this library here. I need add a option to skip this part.

Do you have more complete sample btw, like :

  • install npm install polymer
  • add this element to dom
  • copy this file and run.

then I might get a chance to have a quick look later this week.

vegarringdal avatar Jan 18 '21 17:01 vegarringdal

Any reason why you dont use lit-element or something newer?

We use both, we are in a transition phase.

I will create a test project!

Thanks

danielvanmil avatar Jan 18 '21 18:01 danielvanmil