aboutsummaryrefslogtreecommitdiff
path: root/src/components/timeline/timeline.js
diff options
context:
space:
mode:
authorlambadalambda <gitgud@rogerbraun.net>2017-06-03 12:30:51 -0400
committerlambadalambda <gitgud@rogerbraun.net>2017-06-03 12:30:51 -0400
commitdcf030470dc42fbd518e3b4600b98cad1e06a84c (patch)
tree7a8ea99e41d3d59a3e692f6b53419addbc3b8eaa /src/components/timeline/timeline.js
parente901e064de8f961450129013978ca72666a7e7e8 (diff)
parent65646c5a125126bca97b0f5bf5f43c9544fd2cb2 (diff)
Merge branch 'feature/autoloading-when-scrolled-to-bottom' into 'develop'
Automatic loading/infinite scrolling See merge request !85
Diffstat (limited to 'src/components/timeline/timeline.js')
-rw-r--r--src/components/timeline/timeline.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index d5a9adcc..6070e442 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -20,6 +20,8 @@ const Timeline = {
const credentials = store.state.users.currentUser.credentials
const showImmediately = this.timeline.visibleStatuses.length === 0
+ window.onscroll = this.scrollLoad
+
timelineFetcher.fetchAndUpdate({
store,
credentials,
@@ -42,6 +44,11 @@ const Timeline = {
older: true,
showImmediately: true
}).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
+ },
+ scrollLoad (e) {
+ if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (document.body.scrollHeight - 750)) {
+ this.fetchOlderStatuses()
+ }
}
}
}