I am Using annyang.js for speech-recognition which have 2 different functions, for start annyang.start()
and for stop annyang.abort()
Now how do i make a toggle button which will fire both of these functions?
my code
<div class="action" onclick="actionToogle()">
JS
<script>
function actionToogle() {
var action = document.querySelector(".action");
action.classList.toggle("active",annyang.start());
}
</script>
currently its just starting the recognition by annyang.start()
,
but i want whenever i click the button the recognition will be stop by annyang.abort()