Improve more button implementation and fix lint.

This commit is contained in:
Richard Lewis 2018-08-31 21:37:39 +03:00 committed by Pavel Djundik
parent 8dff4a9478
commit 32776f0642
3 changed files with 10 additions and 10 deletions

View File

@ -109,13 +109,10 @@ export default {
activeChannel: Object, activeChannel: Object,
networks: Array, networks: Array,
}, },
methods: {
isPublic: () => document.body.classList.contains("public"),
},
mounted() { mounted() {
// Make a single throttled resize listener available to all components // Make a single throttled resize listener available to all components
this.debouncedResize = throttle(() => { this.debouncedResize = throttle(() => {
this.$root.$emit('resize'); this.$root.$emit("resize");
}, 100); }, 100);
window.addEventListener("resize", this.debouncedResize, {passive: true}); window.addEventListener("resize", this.debouncedResize, {passive: true});
@ -123,5 +120,8 @@ export default {
beforeDestroy() { beforeDestroy() {
window.removeEventListener("resize", this.debouncedResize); window.removeEventListener("resize", this.debouncedResize);
}, },
methods: {
isPublic: () => document.body.classList.contains("public"),
},
}; };
</script> </script>

View File

@ -147,16 +147,17 @@ export default {
return; return;
} }
this.resizeListener = () => {this.handleResize()}; this.$root.$on("resize", this.handleResize);
this.$root.$on('resize', this.resizeListener);
this.onPreviewUpdate(); this.onPreviewUpdate();
}, },
beforeDestroy() {
this.$root.$off("resize", this.handleResize);
},
destroyed() { destroyed() {
// Let this preview go through load/canplay events again, // Let this preview go through load/canplay events again,
// Otherwise the browser can cause a resize on video elements // Otherwise the browser can cause a resize on video elements
this.link.canDisplay = false; this.link.canDisplay = false;
this.$root.$off('resize', this.resizeListener);
}, },
methods: { methods: {
onPreviewUpdate() { onPreviewUpdate() {

View File

@ -187,8 +187,7 @@ export default {
this.$refs.chat.addEventListener("scroll", this.debouncedScroll, {passive: true}); this.$refs.chat.addEventListener("scroll", this.debouncedScroll, {passive: true});
this.resizeListener = () => {this.handleResize()} this.$root.$on("resize", this.handleResize);
this.$root.$on('resize', this.resizeListener);
this.$nextTick(() => { this.$nextTick(() => {
if (this.historyObserver) { if (this.historyObserver) {
@ -197,7 +196,7 @@ export default {
}); });
}, },
beforeDestroy() { beforeDestroy() {
this.$root.$off('resize', this.resizeListener); this.$root.$off("resize", this.handleResize);
this.$refs.chat.removeEventListener("scroll", this.debouncedScroll); this.$refs.chat.removeEventListener("scroll", this.debouncedScroll);
}, },
destroyed() { destroyed() {