github alpinejs/alpine v2.2.0
on GitHub

Added

  • $watch('prop', callback) has been added for watching data property changes.
    html <div x-data="{ open: false }" x-init="$watch('open', value => console.log(value))"> <button @click="open = ! open">Toggle Open</button> </div>
    (In the example, if the button is clicked, the value will be echoed out)
4 months ago