ich habe folgendes in der App.vue import { inject, onMounted, provide, reactive } from…
Jump to turn (6)
- 1ich habe folgendes in der App.vue import { inject, onMounted, provide, reactive
- 2das modul sieht in etwa so aus import { Chat, ChatEvents } from "twitch-js"; imp
- 3"Der Event Bus muss zuerst bereitgestellt werden, bevor ein Kind- oder Nachfahre
- 4in meinem code wird eventbus doch vor useTwitchChat instantiiert
- 5wie kann ich denn sicherstellen dass provide('eventBus', reactive(eventBus)); in
- 6in einer struktur wie export function useTwitchChat() { var eventBus = null; con
- User
ich habe folgendes in der App.vue
import { inject, onMounted, provide, reactive } from 'vue';
import mitt from 'mitt'; const eventBus = mitt();
provide('eventBus', reactive(eventBus));
import { useWebSocket } from '@/modules/websocketModule'; const socketUrl = 'ws://localhost:10000'; const socket = useWebSocket(socketUrl);
import { useTwitchChat } from './modules/useTwitchChat'; const chat = useTwitchChat();
im useTwitchChat module bekomme ich in der function useTwitchChat() die meldung eventBus2 undefined bei
const eventBus = inject('eventBus'); console.log('eventBus2',eventBus)
- Assistant