I have a timer, and a function by which the timer stops. I want to use emit in a function, it doesn't work.
const stopTimer = () => {
clearInterval(timer.value);
const emit = defineEmits(["end"]);
emit("end", reactionTime.value);
};
defineEmits
should be called top-level in <script setup>
and not inside any arrow function.