DEV Community

Discussion on: LitElement: using web components

Collapse
 
link2twenty profile image
Andrew Bone

I don't think you'd ever want to add more parameters with an event. Looking at your example the params were attached to this anyway so we can just get them with the function.

updateChecked(e) {
  console.log(e, this.param2, this.param3);
}

render() {
  return html`
    <label class="md_switch">
      <input
        @change="${this.updateChecked}"
        ?checked="${this.checked}"
        ?disabled="${this.disabled}"
        type="checkbox"
        />
      <span class="md_switch__toggle"></span>
      <slot></slot>
    </label>
  `;
}