Remove unused ft-intersection-observer component (#2563)

This commit is contained in:
absidue 2022-09-11 20:29:27 +02:00 committed by GitHub
parent 2d2c1e7a0b
commit 036abdc96b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 59 deletions

View File

@ -1,54 +0,0 @@
import Vue from 'vue'
export default Vue.extend({
name: 'FtIntersectionObserver',
props: {
checkOnMount: {
type: Boolean,
default: false
},
margin: {
type: String,
default: '0px 0px 0px 0px'
},
observeParent: {
type: Boolean,
default: false
},
threshold: {
type: Number,
default: 1
}
},
data() {
const observer = new IntersectionObserver(this.handleIntersection, {
rootMargin: this.margin,
threshold: this.threshold
})
const runOnce = false
return {
observer,
runOnce
}
},
mounted() {
this.observer.observe(this.observeParent ? this.$refs.elem.parentElement : this.$refs.elem)
},
beforeDestroy() {
this.observer.disconnect()
},
methods: {
handleIntersection(entries) {
if (!this.runOnce) {
this.runOnce = true
if (!this.checkOnMount) {
return
}
}
this.$emit(entries[0].isIntersecting ? 'intersected' : 'unintersected')
}
}
})

View File

@ -1,5 +0,0 @@
<template>
<div ref="elem" />
</template>
<script src="./ft-intersection-observer.js" />