Skip to content

Commit

Permalink
import fix (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Jun 1, 2024
1 parent 664d560 commit b6ee610
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-dolphins-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro-vtbot': patch
---

Fixes a bug with imports when using loading-indicator.ts
14 changes: 3 additions & 11 deletions components/loading-indicator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/// <reference types="astro/client" />
import {
TRANSITION_AFTER_PREPARATION,
TRANSITION_BEFORE_PREPARATION,
TRANSITION_BEFORE_SWAP,
TRANSITION_PAGE_LOAD,
} from 'astro:transitions/client';

let show: () => void;
let hide: () => void;
let initializer: (() => void | Promise<void>) | undefined;
Expand All @@ -32,9 +24,9 @@ const doInit = () => {

export function initialize(onPageLoad?: () => void | Promise<void>, lowPrio = false) {
if (!(initializer && lowPrio)) initializer = onPageLoad;
document.addEventListener(TRANSITION_PAGE_LOAD, doInit);
document.addEventListener(TRANSITION_BEFORE_PREPARATION, doShow);
document.addEventListener(TRANSITION_AFTER_PREPARATION, doHide);
document.addEventListener("astro:page-load", doInit);
document.addEventListener("astro:before-preparation", doShow);
document.addEventListener("astro:after-preparation", doHide);
}

type Options = {
Expand Down

0 comments on commit b6ee610

Please sign in to comment.