Skip to content

Commit

Permalink
feat(ac): add AppLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
altrusl committed Jan 28, 2024
1 parent a614f26 commit 714c104
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/composables/useAppLoader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { computed, reactive, ref } from "vue";
import { uuid } from "@/app/utils/uuid";

const loaderSet = reactive(new Set<string>());
const loading = computed(() => loaderSet.size > 0);

export function useAppLoader() {
const _uuid: string = uuid();

function startLoading() {
loaderSet.add(_uuid);
}
function stopLoading() {
loaderSet.delete(_uuid);
}

return { loading, startLoading, stopLoading };
}

0 comments on commit 714c104

Please sign in to comment.