Add support for attribute changed callback
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'] },
👍
👋 @GiacomoSorbi @PeterJCLaw @lirsacc Any chance I could get some 👀 on this? 🙏
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.
Thanks for the contribution. Unfortunately we're no longer maintaining this project, so I'm going to close this (and then archive the repo).