detect livewire is loading in javascript code example
Example: detect livewire is loading in javascript
window.livewireLoading = false;
document.addEventListener("DOMContentLoaded", () => {
Livewire.hook('message.sent', (message, component) => {
livewireLoading = true;
})
Livewire.hook('message.processed', (message, component) => {
livewireLoading = false;
})
});