mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-10-28 03:54:13 +00:00
* fix(misskey-js): チャットのChannel型定義を追加 * fix(backend); canChatで塞いでいない書き込み系のAPIを塞ぐ * fix(frontend): チャット周りのフロントエンド型修正 * lint fix * fix broken lockfile * fix * refactor * wip * wip * wip * clean up --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
21 lines
571 B
TypeScript
21 lines
571 B
TypeScript
/*
|
|
* 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();
|
|
});
|
|
}
|