I think this would be useful for anyone who wants to hook into Alpine from outside of their components, possibly inside of a scoped JS file.
I have a working branch for this, using the dispatch() function from Livewire. I'm also working on a devtools panel for alpine and this would be super useful so I don't have to mess around with more Proxies etc, cc/ @calebporzio
After some dispute on the events that should be fired, to begin with I'm going to keep the list short:
The transition based events will be fired on the element that is actually transitioning. The event will be bubbled up to the parent component too, as per JavaScript behaviour so the event can be listened to there.
The alpine:loaded event will be fired at the document level after all of the components have been initialised and observation have started.
Any more ideas for events are welcome below.
Closing this issue for now, since this will probably be re-evaluated for v3.
This is exactly what's needed for something like sequential animations, instead of trying to fake it with animation delays.
Most helpful comment
After some dispute on the events that should be fired, to begin with I'm going to keep the list short:
The transition based events will be fired on the element that is actually transitioning. The event will be bubbled up to the parent component too, as per JavaScript behaviour so the event can be listened to there.
The
alpine:loadedevent will be fired at the document level after all of the components have been initialised and observation have started.Any more ideas for events are welcome below.