Merge branch 'misskey-develop' into merge/2025-03-24
# Conflicts: # package.json # packages/backend/src/core/entities/NotificationEntityService.ts # packages/backend/src/types.ts # packages/frontend/src/pages/admin/modlog.ModLog.vue # packages/misskey-js/src/consts.ts # packages/misskey-js/src/entities.ts
This commit is contained in:
commit
40975719ec
82 changed files with 1563 additions and 298 deletions
21
packages/frontend/src/use/use-mutation-observer.ts
Normal file
21
packages/frontend/src/use/use-mutation-observer.ts
Normal 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, ShallowRef } from 'vue';
|
||||
|
||||
export function useMutationObserver(targetNodeRef: Ref<HTMLElement | 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();
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue