diff options
| author | lambda <pleromagit@rogerbraun.net> | 2017-11-13 09:10:44 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2017-11-13 09:10:44 +0000 |
| commit | d6478068f87689b981ed1e5b54e28433c9f89ef6 (patch) | |
| tree | 0e42be99b102f84bb70c288ccf854dfbf0bf3c3f /src/components/timeline/timeline.js | |
| parent | f74ad6d3e1cbfa3d855bdd993d2d6a060b8deb2d (diff) | |
| parent | 46f23b7de7a5e27dd4f9f13f063d263fbb1ec85d (diff) | |
Merge branch 'feature/streaming-posts' into 'develop'
Streaming posts
See merge request pleroma/pleroma-fe!151
Diffstat (limited to 'src/components/timeline/timeline.js')
| -rw-r--r-- | src/components/timeline/timeline.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 6968bc6f..613b8a34 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -11,6 +11,11 @@ const Timeline = { 'userId', 'tag' ], + data () { + return { + paused: false + } + }, computed: { timelineError () { return this.$store.state.statuses.error }, followers () { @@ -21,6 +26,9 @@ const Timeline = { }, viewing () { return this.timeline.viewing + }, + newStatusCount () { + return this.timeline.newStatusCount } }, components: { @@ -56,6 +64,7 @@ const Timeline = { methods: { showNewStatuses () { this.$store.commit('showNewStatuses', { timeline: this.timelineName }) + this.paused = false }, fetchOlderStatuses () { const store = this.$store @@ -90,6 +99,21 @@ const Timeline = { this.fetchOlderStatuses() } } + }, + watch: { + newStatusCount (count) { + if (!this.$store.state.config.streaming) { + return + } + if (count > 0) { + // only 'stream' them when you're scrolled to the top + if (window.pageYOffset < 15 && !this.paused) { + this.showNewStatuses() + } else { + this.paused = true + } + } + } } } |
