remove user-message event listener on ta dismount
This commit is contained in:
parent
fd49d25696
commit
1b6f278620
2 changed files with 21 additions and 13 deletions
|
|
@ -1,14 +1,16 @@
|
|||
import { ref, computed, inject } from 'vue';
|
||||
import useTextInputAnims from "./textAnime";
|
||||
import { Ref } from "@/types/vueRef/index";
|
||||
/*
|
||||
* text rendering logic used by inputController
|
||||
*/
|
||||
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import useTextInputAnims from "./textAnime";
|
||||
import { Ref } from "@/types/vueRef/index";
|
||||
import useMitt from "@/modules/mitt";
|
||||
|
||||
export default function useTextVisualizer(input: Ref<string>) {
|
||||
const inputHeight = ref(42);
|
||||
const inputWidth = ref(0);
|
||||
|
||||
const emitter: any = inject("mitt");
|
||||
const { emitter } = useMitt();
|
||||
const { animateSend, verticalShiftInput, inputAppear } = useTextInputAnims();
|
||||
|
||||
async function renderTextInput() {
|
||||
|
|
@ -32,10 +34,16 @@ export default function useTextVisualizer(input: Ref<string>) {
|
|||
}
|
||||
}
|
||||
|
||||
emitter.on("user-message", () => {
|
||||
const inputEl = document.getElementsByClassName("inputContainer");
|
||||
const foreignEl = inputEl[0] as HTMLElement;
|
||||
animateSend(foreignEl, inputHeight.value, input);
|
||||
onMounted(() => {
|
||||
emitter.on("user-message", () => {
|
||||
const inputEl = document.getElementsByClassName("inputContainer");
|
||||
const foreignEl = inputEl[0] as HTMLElement;
|
||||
animateSend(foreignEl, inputHeight.value, input);
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.all.clear();
|
||||
});
|
||||
|
||||
const textInputXoffset = computed(() => {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ wss.on("connection", function connection(ws, req) {
|
|||
ws.on("message", function incoming(message) {
|
||||
|
||||
console.log(message)
|
||||
if (message === 'no-token' || message === 'undefined') {
|
||||
console.log('no token to authenticate');
|
||||
ws.send('locked');
|
||||
}
|
||||
if (message === 'no-token' || message === 'undefined') {
|
||||
console.log('no token to authenticate');
|
||||
ws.send('success');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue