mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
feature: nieskończona lista historii dr/rj scenerii
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
data: () => ({
|
||||
observer: null as IntersectionObserver | null,
|
||||
observerTarget: null as Element | null,
|
||||
}),
|
||||
|
||||
methods: {
|
||||
mountObserver(actionFunction: () => void, target: Element) {
|
||||
this.observer = new IntersectionObserver((entries) => {
|
||||
if (entries[0].intersectionRatio > 0) actionFunction();
|
||||
});
|
||||
|
||||
this.observer.observe(target);
|
||||
},
|
||||
|
||||
unmountObserver() {
|
||||
if (!this.observerTarget) return;
|
||||
|
||||
this.observer?.unobserve(this.observerTarget);
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user