diff --git a/src/index.ts b/src/index.ts index e33ef55..b1ae3db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,10 +75,15 @@ export default class extends Controller { .then((html: string) => { this.element.innerHTML = html + this.dispatch('content-loader:loaded') + if (this.loadScriptsValue) { this.loadScripts() } }) + .catch(function (error) { + this.dispatch('content-loader:failed', { detail: { error: error } }) + }) } startRefreshing (): void {