summaryrefslogtreecommitdiff
path: root/packages/frontend/src/directives/appear.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-10-19 11:36:00 +0900
committerGitHub <noreply@github.com>2025-10-19 11:36:00 +0900
commitd98bf012b59b343559dd679f0b4ae370ebd75079 (patch)
tree00aa135936d6836e8d051ab9f5648464ba057e41 /packages/frontend/src/directives/appear.ts
parentRevert typeorm patches (#16664) (diff)
downloadmisskey-d98bf012b59b343559dd679f0b4ae370ebd75079.tar.gz
misskey-d98bf012b59b343559dd679f0b4ae370ebd75079.tar.bz2
misskey-d98bf012b59b343559dd679f0b4ae370ebd75079.zip
refactor(frontend): カスタムディレクティブの型付け (#16659)
* refactor(frontend): カスタムディレクティブの型付け * fix
Diffstat (limited to 'packages/frontend/src/directives/appear.ts')
-rw-r--r--packages/frontend/src/directives/appear.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/frontend/src/directives/appear.ts b/packages/frontend/src/directives/appear.ts
index f5fec108dc..f714871420 100644
--- a/packages/frontend/src/directives/appear.ts
+++ b/packages/frontend/src/directives/appear.ts
@@ -6,12 +6,16 @@
import { throttle } from 'throttle-debounce';
import type { Directive } from 'vue';
-export default {
- mounted(src, binding, vn) {
+interface HTMLElementWithObserver extends HTMLElement {
+ _observer_?: IntersectionObserver;
+}
+
+export const appearDirective = {
+ mounted(src, binding) {
const fn = binding.value;
if (fn == null) return;
- const check = throttle(1000, (entries) => {
+ const check = throttle<IntersectionObserverCallback>(1000, (entries) => {
if (entries.some(entry => entry.isIntersecting)) {
fn();
}
@@ -24,7 +28,7 @@ export default {
src._observer_ = observer;
},
- unmounted(src, binding, vn) {
+ unmounted(src) {
if (src._observer_) src._observer_.disconnect();
},
-} as Directive;
+} as Directive<HTMLElementWithObserver, () => void>;