mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
* feat: replace root events with event bus events * fix: prevent cypress from replacing global with globalThis in import path * feat: remove emitter mixin * fix: replace component events with event bus * fix: fix linting issue * fix: fix breaking expression switch * chore: prettify ndv e2e suite code
41 lines
772 B
Vue
41 lines
772 B
Vue
<template>
|
|
<span ref="observed">
|
|
<slot></slot>
|
|
</span>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import type { PropType } from 'vue';
|
|
import { defineComponent } from 'vue';
|
|
import type { EventBus } from 'n8n-design-system/utils';
|
|
import { createEventBus } from 'n8n-design-system/utils';
|
|
|
|
export default defineComponent({
|
|
name: 'IntersectionObserved',
|
|
props: {
|
|
enabled: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
eventBus: {
|
|
type: Object as PropType<EventBus>,
|
|
default: () => createEventBus(),
|
|
},
|
|
},
|
|
mounted() {
|
|
if (!this.enabled) {
|
|
return;
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.eventBus.emit('observe', this.$refs.observed);
|
|
});
|
|
},
|
|
beforeDestroy() {
|
|
if (this.enabled) {
|
|
this.eventBus.emit('unobserve', this.$refs.observed);
|
|
}
|
|
},
|
|
});
|
|
</script>
|