sljavi / handsfree-for-website

Turn on voice control in your website. Demo ->

Home Page:https://sljavi.github.io/handsfree-for-website/dist/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read properties of undefined (reading 'init')

Siyamfahad opened this issue · comments

I really like your project and wanna use it on my website, but after adding the code it says
Cannot read properties of undefined (reading 'init') in the console.
how can I fix this?

<script src="js/handsfree-for-website.js" crossorigin></script>
   <script>
       var handsfree = window.hansfreeForWebsite.init();
           handsfree.turnOn();
</script>

hi @Siyamfahad

You have a typo!

it's var handsfree = window.handsfreeForWebsite.init();

@sljavi Thank you for your reply, sir.
it was my bad...
this project is just awesome, can you please give me an idea, how can I add a prefix for this, currently it's always listening, I want it to respond on prefix (e.g: Alexa scroll down)

@Siyamfahad you could create a voice command for listening to the keyword you want to pay attention to, and other voice commands for the rest of the actions.
In this case, if the voice command that listens for the keyword was executed previously, you allow to execute the rest of the voice commands, otherwise do nothing.