ayo, Thinking of an
attachEffect
function to attach a callback to property changes :)class Counter extends WebComponent { static properties = ["count"]; onInit() { this.props.count = 0; this.onclick = () => ++this.props.count; attachEffect(this.props.count, () => console.log("value changed!")); } get template() { return `<button>${this.props.count}</button>`; } }
Add comment