Explorar o código

Поправка

Book Pauk %!s(int64=6) %!d(string=hai) anos
pai
achega
6aa935141b
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      client/components/Reader/TextPage/TextPage.vue

+ 5 - 1
client/components/Reader/TextPage/TextPage.vue

@@ -18,7 +18,7 @@ import bookManager from '../share/bookManager';
 export default @Component({
     watch: {
         bookPos: function(newValue) {
-            this.$emit('book-pos-changed', {bookPos: newValue});
+            this.debouncedEmitPosChange(newValue);
             this.drawPage();
         },
     },
@@ -36,6 +36,10 @@ class TextPage extends Vue {
         this.dispatch = this.$store.dispatch;
         this.config = this.$store.state.config;
         this.reader = this.$store.state.reader;
+
+        this.debouncedEmitPosChange = _.debounce((newValue) => {
+            this.$emit('book-pos-changed', {bookPos: newValue});
+        }, 100);
     }
 
     showBook() {