From e1cd7c94fb13f8e49667b17554d22ce8de627a2a Mon Sep 17 00:00:00 2001 From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 10 May 2025 07:58:26 +0900 Subject: refactor(frontend): use* 関数の格納場所のフォルダ名を composables に変更 (#16004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(frontend): use* 関数の格納場所を正式名称(composables)に変更 * migrate * move useLoading --- .../frontend/src/components/hook/useLoading.ts | 52 ---------------------- 1 file changed, 52 deletions(-) delete mode 100644 packages/frontend/src/components/hook/useLoading.ts (limited to 'packages/frontend/src/components/hook/useLoading.ts') diff --git a/packages/frontend/src/components/hook/useLoading.ts b/packages/frontend/src/components/hook/useLoading.ts deleted file mode 100644 index 6c6ff6ae0d..0000000000 --- a/packages/frontend/src/components/hook/useLoading.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { computed, h, ref } from 'vue'; -import MkLoading from '@/components/global/MkLoading.vue'; - -export const useLoading = (props?: { - static?: boolean; - inline?: boolean; - colored?: boolean; - mini?: boolean; - em?: boolean; -}) => { - const showingCnt = ref(0); - - const show = () => { - showingCnt.value++; - }; - - const close = (force?: boolean) => { - if (force) { - showingCnt.value = 0; - } else { - showingCnt.value = Math.max(0, showingCnt.value - 1); - } - }; - - const scope = (fn: () => T) => { - show(); - - const result = fn(); - if (result instanceof Promise) { - return result.finally(() => close()); - } else { - close(); - return result; - } - }; - - const showing = computed(() => showingCnt.value > 0); - const component = computed(() => showing.value ? h(MkLoading, props) : null); - - return { - show, - close, - scope, - component, - showing, - }; -}; -- cgit v1.2.3-freya