Mercurial > gemma
diff client/src/components/fairway/Fairwayprofile.vue @ 3682:c086f5176ef2
client: diagrams: fixed removal of resize listener
listeners were not removed so diagrams were redrawn even if they were closed/not visible/mounted, leading to console errors.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 18 Jun 2019 12:53:05 +0200 |
parents | c91bcb92e0b7 |
children | 4a00ff7e44f0 |
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue Tue Jun 18 12:43:01 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Tue Jun 18 12:53:05 2019 +0200 @@ -165,6 +165,7 @@ }, data() { return { + resizeListenerFunction: null, width: null, height: null, margin: { @@ -802,7 +803,8 @@ } }, created() { - window.addEventListener("resize", debounce(this.drawDiagram), 100); + this.resizeListenerFunction = debounce(this.drawDiagram, 100); + window.addEventListener("resize", this.resizeListenerFunction); }, mounted() { this.drawDiagram(); @@ -835,7 +837,7 @@ this.drawDiagram(); }, destroyed() { - window.removeEventListener("resize", debounce(this.drawDiagram)); + window.removeEventListener("resize", this.resizeListenerFunction); } }; </script>