diff --git a/js/wire-extender.js b/js/wire-extender.js index bb2c45d..2526489 100644 --- a/js/wire-extender.js +++ b/js/wire-extender.js @@ -1,6 +1,7 @@ let livewireScript; let componentAssets; let currentScript = document.currentScript; +let livewireStarted = false; function getUri(append = '') { @@ -34,6 +35,10 @@ function getEmbedUri() function injectLivewire() { + if (window.Livewire || livewireStarted) { + return; + } + const style = document.createElement('style'); style.innerHTML = ''; document.head.appendChild(style); @@ -46,12 +51,18 @@ function injectLivewire() } function waitForLivewireAndStart() { + if (livewireStarted) { + return; + } + if(window.Livewire) { startLivewire(); } livewireScript.onload = async function () { await startLivewire(); } + + livewireStarted = true; } async function startLivewire(assets)