1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 15:45:41 +02:00

refactor(frontend): use* 関数の格納場所のフォルダ名を composables に変更 (#16004)

* refactor(frontend): use* 関数の格納場所を正式名称(composables)に変更

* migrate

* move useLoading
This commit is contained in:
かっこかり
2025-05-10 07:58:26 +09:00
committed by GitHub
parent c803f842ba
commit e1cd7c94fb
57 changed files with 53 additions and 53 deletions

View File

@@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { onUnmounted, watch } from 'vue';
import type { Ref } from 'vue';
export function useMutationObserver(targetNodeRef: Ref<HTMLElement | null | undefined>, options: MutationObserverInit, callback: MutationCallback): void {
const observer = new MutationObserver(callback);
watch(targetNodeRef, (targetNode) => {
if (targetNode) {
observer.observe(targetNode, options);
}
}, { immediate: true });
onUnmounted(() => {
observer.disconnect();
});
}