File size: 779 Bytes
6609677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<template>
    <div :style="style">
        <jupyter-widget v-for="child in children" :key="child" :widget="child"></jupyter-widget>
    </div>
</template>

<script>
module.exports = {
    created() {
        this.resizeObserver = new ResizeObserver(entries => {
            this._updateViewData();
        });
    },
    mounted() {
        this.resizeObserver.observe(this.$el);
        this._updateViewData();
    },
    destroyed() {
        this.resizeObserver.unobserve(this.$el);
    },
    methods: {
        _updateViewData() {
            const view_data = {
                width: this.$el.clientWidth,
                height: this.$el.clientHeight,
            };
            this.view_data = view_data
        }
    },
}
</script>

<style id="viewlistener"></style>