Skip to content

Commit ca43271

Browse files
committed
Use resize observer
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 0c3f4c9 commit ca43271

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

core/src/components/AppMenu.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default {
6868
return {
6969
apps: loadState('core', 'apps', {}),
7070
appLimit: 0,
71+
observer: null,
7172
}
7273
},
7374
computed: {
@@ -87,9 +88,13 @@ export default {
8788
},
8889
},
8990
mounted() {
90-
window.addEventListener('resize', this.resize)
91+
this.observer = new ResizeObserver(this.resize)
92+
this.observer.observe(this.$el)
9193
this.resize()
9294
},
95+
beforeDestroy() {
96+
this.observer.disconnect()
97+
},
9398
methods: {
9499
setNavigationCounter(id, counter) {
95100
this.$set(this.apps[id], 'unread', counter)

0 commit comments

Comments
 (0)