remove old message event listeners
This commit is contained in:
parent
e914c0ca14
commit
3cf22d61ac
13 changed files with 142 additions and 219 deletions
|
|
@ -17,24 +17,16 @@ export default function useInputController() {
|
|||
const paths = ref([]);
|
||||
const audioBubbleWidth = ref(10);
|
||||
let stream: MediaStream;
|
||||
const emitter: any = inject("mitt");
|
||||
const emitter: any = inject("mitt");
|
||||
|
||||
// send message on ENTER
|
||||
const enterCallback = (input: string) => {
|
||||
|
||||
const message = {
|
||||
audio: 0,
|
||||
text: input
|
||||
audio: 0,
|
||||
text: input
|
||||
};
|
||||
console.log('emit message on enter', message);
|
||||
emitter.emit("animateSend", message);
|
||||
|
||||
// await response
|
||||
// window.postMessage({
|
||||
// myTypeField: 'send-message',
|
||||
// message: message
|
||||
// }, '*')
|
||||
|
||||
}
|
||||
|
||||
const { visualizeStreamAsPaths, expandBubble } = useAudioVisualizer(visualizeStream);
|
||||
|
|
@ -42,13 +34,13 @@ export default function useInputController() {
|
|||
const { textInputXoffset, renderTextInput } = useTextVisualizer(input);
|
||||
|
||||
// stops stream recording on space key up
|
||||
function keyupHandler(e: any) {
|
||||
function keyupHandler(_e) {
|
||||
if (e.key === " " && visualizeStream.value) {
|
||||
console.log("stop recording");
|
||||
|
||||
window.postMessage({
|
||||
myTypeField: 'update-recorder',
|
||||
record: false
|
||||
myTypeField: 'update-recorder',
|
||||
record: false
|
||||
}, '*')
|
||||
|
||||
visualizeStream.value = false;
|
||||
|
|
@ -80,8 +72,8 @@ export default function useInputController() {
|
|||
visualizeStream.value = true;
|
||||
|
||||
window.postMessage({
|
||||
myTypeField: 'update-recorder',
|
||||
record: true
|
||||
myTypeField: 'update-recorder',
|
||||
record: true
|
||||
}, '*')
|
||||
|
||||
expandBubble(audioBubbleWidth);
|
||||
|
|
|
|||
Loading…
Reference in a new issue