Alpinejs store accessible from outside

PHOTO EMBED

Fri Dec 01 2023 13:22:32 GMT+0000 (Coordinated Universal Time)

Saved by @AlexP #js #alpinejs

<script>
document.addEventListener('alpine:init', () => {
    Alpine.store('notifications', {
        items: [],
        notify(message) {
            this.items.push(message)
        }
    })
})
</script>
content_copyCOPY