refactor: instantiation of web components

This commit is contained in:
Zack Spear
2024-05-16 09:03:34 -07:00
committed by Zack Spear
parent ff24f12cae
commit ba772add54
3 changed files with 7 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
<script lang="ts" setup>
const nuxtApp = useNuxtApp();
const { registerEntry } = useCustomElements();
onBeforeMount(() => {
// @ts-expect-error - becuase customElements is not a type in nuxtApp and is not provided by the nuxt plugin
nuxtApp.$customElements.registerEntry('UnraidComponents');
registerEntry('UnraidComponents');
});
</script>

View File

@@ -5,9 +5,10 @@ import type { SendPayloads } from '~/store/callback';
import { serverState } from '~/_data/serverState';
const nuxtApp = useNuxtApp();
const { registerEntry } = useCustomElements();
onBeforeMount(() => {
// @ts-expect-error - customElements doesn't provide types
nuxtApp.$customElements.registerEntry('UnraidComponents');
registerEntry('UnraidComponents');
});
const valueToMakeCallback = ref<SendPayloads | undefined>();

View File

@@ -1,10 +1,9 @@
<script lang="ts" setup>
import { serverState } from '~/_data/serverState';
const nuxtApp = useNuxtApp();
const { registerEntry } = useCustomElements();
onBeforeMount(() => {
// @ts-expect-error - customElements not providing types here
nuxtApp.$customElements.registerEntry('UnraidComponents');
registerEntry('UnraidComponents');
});
</script>