|
|
@@ -145,15 +145,19 @@ export default {
|
|
145
|
145
|
|
|
146
|
146
|
console.warn('setting up intersection handler for:', this.type)
|
|
147
|
147
|
const footerEl = document.querySelector(".page--list > article footer")
|
|
148
|
|
- console.warn('found el: ',footerEl)
|
|
|
148
|
+ // console.warn('found el: ',footerEl)
|
|
149
|
149
|
if(!footerEl) return
|
|
150
|
|
- console.warn('attach to: ',footerEl)
|
|
|
150
|
+ // console.warn('attach to: ',footerEl)
|
|
151
|
151
|
|
|
152
|
152
|
const onIntersect = (entries, observer) => {
|
|
153
|
153
|
console.log('intersection handler fired...')
|
|
154
|
154
|
entries.forEach(entry => {
|
|
155
|
155
|
if (!entry.isIntersecting) return
|
|
156
|
156
|
console.log("intersected:", entry)
|
|
|
157
|
+ this.observer.unobserve(target)
|
|
|
158
|
+ setTimeout(() => {
|
|
|
159
|
+ this.loadMorePosts()
|
|
|
160
|
+ }, 1000)
|
|
157
|
161
|
})
|
|
158
|
162
|
}
|
|
159
|
163
|
const settings = {
|
|
|
@@ -162,7 +166,6 @@ export default {
|
|
162
|
166
|
this.observer = new IntersectionObserver(onIntersect, settings)
|
|
163
|
167
|
this.observer['_for_type'] = this.type
|
|
164
|
168
|
this.observer.observe(footerEl)
|
|
165
|
|
- console.log(this.observer)
|
|
166
|
169
|
},
|
|
167
|
170
|
unsetIntersectionLoader(type) {
|
|
168
|
171
|
if(!type) return console.error('cannot unset intersection handler for undefined type...')
|