Files
Automata/packages/editor-ui/src/components/IntersectionObserved.vue
OlegIvaniv 07c360c30d refactor(editor): Replace this.$props (no-changelog) (#5928)
* refactor(editor): Replace this. (no-changelog)

* Lintfix
2023-04-07 12:21:17 +02:00

30 lines
565 B
Vue

<template>
<span ref="observed">
<slot></slot>
</span>
</template>
<script lang="ts">
import mixins from 'vue-typed-mixins';
import emitter from '@/mixins/emitter';
export default mixins(emitter).extend({
name: 'IntersectionObserved',
props: ['enabled'],
mounted() {
if (!this.enabled) {
return;
}
this.$nextTick(() => {
this.$dispatch('IntersectionObserver', 'observe', this.$refs.observed);
});
},
beforeDestroy() {
if (this.enabled) {
this.$dispatch('IntersectionObserver', 'unobserve', this.$refs.observed);
}
},
});
</script>