Преглед на файлове

Move if clause out of setTimeout

sbkwgh преди 8 години
родител
ревизия
ccf73a6166
променени са 1 файла, в които са добавени 4 реда и са изтрити 6 реда
  1. 4 6
      src/components/routes/Thread.vue

+ 4 - 6
src/components/routes/Thread.vue

@@ -142,12 +142,10 @@
 							window.scrollTo(0, postTop - header - 32)
 
 							this.highlightedPostIndex = i
-
-							setTimeout(() => {
-								if(this.highlightedPostIndex === i) {
-									this.highlightedPostIndex = null
-								}
-							}, 3000)
+							
+							if(this.highlightedPostIndex === i) {
+								setTimeout(() => this.highlightedPostIndex = null, 3000)
+							}
 						})
 
 						break;