elm-web-components icon indicating copy to clipboard operation
elm-web-components copied to clipboard

Add support for attribute changed callback

Open vincentnavetat opened this issue 3 years ago • 3 comments

This would allow an elm web component to update itself when a property is changed. A port would need to be added on the elm side to handle the change.

This is useful when an elm web component needs to be updated dynamically. Especially within another elm app.

Would fix https://github.com/thread/elm-web-components/issues/19

Example:

  onAttributeChanged: (name, oldValue, newValue, ports) => {
    switch (name) {
      case 'page_number':
      ports.pageNumberAttributeChanged.send(parseInt(newValue, 10));
      break;
    }
  },
  setObservedAttributes: () => { return ['page_number'] },

vincentnavetat avatar Jan 21 '21 16:01 vincentnavetat

👍

Zeneixe avatar Jan 22 '21 14:01 Zeneixe

👋 @GiacomoSorbi @PeterJCLaw @lirsacc Any chance I could get some 👀 on this? 🙏

vincentnavetat avatar Jan 29 '21 14:01 vincentnavetat

Hi @vincentnavetat, thanks for the contribution! Just wanted to let you know that we've seen this PR, though I can't promise we'll get to reviewing it soon unfortunately :(. I'll ask if one of my colleagues has some time next week though.

PeterJCLaw avatar Jan 29 '21 19:01 PeterJCLaw

Thanks for the contribution. Unfortunately we're no longer maintaining this project, so I'm going to close this (and then archive the repo).

PeterJCLaw-mns avatar May 03 '23 13:05 PeterJCLaw-mns