Giter VIP home page Giter VIP logo

Comments (4)

treshugart avatar treshugart commented on May 25, 2024 1

Try using props.boolean (not a function anymore). attribute defaults to { source: true } (one-way binding). The default is already false.

If you need to mix in stuff:

{ ...props.boolean, ...{ attribute: true } }

You must also now assign a prop. Getters behave oddly and require ordered initialisation which adds to the weirdness. Setters are much easier to implement and reason about.

class MyComponent extends withComponent(withPreact)) {
  static props = {
    variable: props.boolean
  };
}

// or
MyComponent.props = {};

See the new README in the 5.x branch. The code example there uses the new APIs.

from web-components.

fredyagomez avatar fredyagomez commented on May 25, 2024

@treshugart I guess my library was outdated.

from web-components.

treshugart avatar treshugart commented on May 25, 2024

Hey @fredyagomez, thanks for responding and closing. Sorry I didn't respond earlier. So much work has gone into the webcomponentsjs polyfills since starting this repo, I want to start recommending people use that and the loader they've written there: https://github.com/webcomponents/webcomponentsjs.

from web-components.

fredyagomez avatar fredyagomez commented on May 25, 2024

@treshugart thanks. When doing to migration, I start getting this error "Failed to construct 'HTMLElement': Please use the 'new' operator" I saw an issue before referring to a shim that was included in skatejs/webcomponent but can't recall this.

Also, maybe I have wrong link to documentation, but prop does not work the same. Where can I declare props and the respective defaults? if you have the link for the documentation for 5.x I can take a look there.

static get props() {
    return {
      variable: prop.boolean({
        attribute: true,
        default: false
      })
  }
}

from web-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.