Remove live chat comments after 150 comments to better scroll through chat.

This commit is contained in:
Preston 2020-10-16 23:01:32 -04:00
parent 407449ac65
commit ce3bde6712
1 changed files with 5 additions and 0 deletions

View File

@ -180,6 +180,7 @@ export default Vue.extend({
} }
this.comments.push(comment) this.comments.push(comment)
console.log(this.comments.length)
if (typeof (comment.superchat) !== 'undefined') { if (typeof (comment.superchat) !== 'undefined') {
this.$store.dispatch('getRandomColorClass').then((data) => { this.$store.dispatch('getRandomColorClass').then((data) => {
@ -211,6 +212,10 @@ export default Vue.extend({
if (this.stayAtBottom) { if (this.stayAtBottom) {
liveChatComments.animate({ scrollTop: liveChatComments.prop('scrollHeight') }) liveChatComments.animate({ scrollTop: liveChatComments.prop('scrollHeight') })
} }
if (this.comments.length > 150) {
this.comments = this.comments.splice(this.comments.length - 150, this.comments.length)
}
}, },
removeFromSuperChat: function (id) { removeFromSuperChat: function (id) {