From 30913bebbb1a44280cdf93010b7a87194447e071 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 7 Jun 2018 01:52:03 +0900 Subject: [PATCH] Improve scroll performance --- src/client/app/desktop/views/components/notes.vue | 2 +- src/client/app/desktop/views/pages/deck/deck.column.vue | 2 +- src/client/app/desktop/views/pages/search.vue | 2 +- src/client/app/desktop/views/pages/user/user.header.vue | 2 +- src/client/app/mobile/views/components/notes.vue | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/app/desktop/views/components/notes.vue b/src/client/app/desktop/views/components/notes.vue index 5a147f31e..69f3739f7 100644 --- a/src/client/app/desktop/views/components/notes.vue +++ b/src/client/app/desktop/views/components/notes.vue @@ -74,7 +74,7 @@ export default Vue.extend({ mounted() { document.addEventListener('visibilitychange', this.onVisibilitychange, false); - window.addEventListener('scroll', this.onScroll); + window.addEventListener('scroll', this.onScroll, { passive: true }); }, beforeDestroy() { diff --git a/src/client/app/desktop/views/pages/deck/deck.column.vue b/src/client/app/desktop/views/pages/deck/deck.column.vue index 4dee0db91..458732fa7 100644 --- a/src/client/app/desktop/views/pages/deck/deck.column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.column.vue @@ -51,7 +51,7 @@ export default Vue.extend({ }, mounted() { - this.$refs.body.addEventListener('scroll', this.onScroll); + this.$refs.body.addEventListener('scroll', this.onScroll, { passive: true }); }, beforeDestroy() { this.$refs.body.removeEventListener('scroll', this.onScroll); diff --git a/src/client/app/desktop/views/pages/search.vue b/src/client/app/desktop/views/pages/search.vue index 67e1e3bfe..e79ac1c73 100644 --- a/src/client/app/desktop/views/pages/search.vue +++ b/src/client/app/desktop/views/pages/search.vue @@ -46,7 +46,7 @@ export default Vue.extend({ }, mounted() { document.addEventListener('keydown', this.onDocumentKeydown); - window.addEventListener('scroll', this.onScroll); + window.addEventListener('scroll', this.onScroll, { passive: true }); this.fetch(); }, diff --git a/src/client/app/desktop/views/pages/user/user.header.vue b/src/client/app/desktop/views/pages/user/user.header.vue index 44910bc7f..d52c6b762 100644 --- a/src/client/app/desktop/views/pages/user/user.header.vue +++ b/src/client/app/desktop/views/pages/user/user.header.vue @@ -37,7 +37,7 @@ export default Vue.extend({ mounted() { if (this.user.bannerUrl) { window.addEventListener('load', this.onScroll); - window.addEventListener('scroll', this.onScroll); + window.addEventListener('scroll', this.onScroll, { passive: true }); window.addEventListener('resize', this.onScroll); } }, diff --git a/src/client/app/mobile/views/components/notes.vue b/src/client/app/mobile/views/components/notes.vue index 09cee966a..7aaf0424c 100644 --- a/src/client/app/mobile/views/components/notes.vue +++ b/src/client/app/mobile/views/components/notes.vue @@ -81,7 +81,7 @@ export default Vue.extend({ mounted() { document.addEventListener('visibilitychange', this.onVisibilitychange, false); - window.addEventListener('scroll', this.onScroll); + window.addEventListener('scroll', this.onScroll, { passive: true }); }, beforeDestroy() {