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

View File

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

View File

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