Pārlūkot izejas kodu

:poop: trying even older intersecton handler

tags/0.9.0
J 4 gadus atpakaļ
vecāks
revīzija
319c1e8871
1 mainītis faili ar 10 papildinājumiem un 4 dzēšanām
  1. 10
    4
      vue-theme/src/pages/list.vue

+ 10
- 4
vue-theme/src/pages/list.vue Parādīt failu

@@ -85,8 +85,12 @@ export default {
85 85
             if(!this.keepFetching) return console.warn('nothing left to fetch...')
86 86
 
87 87
             this.loadingFetched = true
88
+            console.warn(
89
+                `loading page ${this.page} of ${type} posts: 
90
+                    ${this.page * this.perPage + 1} through 
91
+                        ${(this.page + 1) * this.perPage}`
92
+            )
88 93
             this.page++
89
-            console.warn(`loading page ${this.page} of ${type} posts: ${this.page * this.perPage + 1} through ${this.page * this.perPage}`)
90 94
             await this.getPosts()
91 95
         },
92 96
         _getSortBy() {
@@ -152,13 +156,14 @@ export default {
152 156
             const footerEl = document.querySelector(INTERSECT_SELECTION)
153 157
             if(!footerEl) return
154 158
 
155
-            const onIntersect = entries => {
156
-                // console.log('intersection handler fired...')
159
+            const onIntersect = (entries, observer) => {
160
+                console.log('intersection handler fired...')
157 161
                 entries.forEach(entry => {
158 162
                     if (!entry.isIntersecting || this.loadingFetched) return
163
+                    console.log("intersected:", entry)
159 164
                     setTimeout(() => {
160 165
                         this.loadMorePosts()
161
-                    }, TIMEOUT)
166
+                    }, 1000)
162 167
                 })
163 168
             }
164 169
             this.observer = new IntersectionObserver(onIntersect, {
@@ -166,6 +171,7 @@ export default {
166 171
             })
167 172
             this.observer['_for_type'] = this.type
168 173
             this.observer.observe(footerEl)
174
+
169 175
         },
170 176
         unsetIntersectionLoader() {
171 177
             const footerEl = document.querySelector(INTERSECT_SELECTION)

Notiek ielāde…
Atcelt
Saglabāt