sljavi / handsfree-for-website

Turn on voice control in your website. Demo ->
https://sljavi.github.io/handsfree-for-website/dist/index.html
MIT License
16 stars 9 forks source link

Cannot read properties of undefined (reading 'init') #23

Closed Siyamfahad closed 1 year ago

Siyamfahad commented 2 years ago

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>
sljavi commented 2 years ago

hi @Siyamfahad

You have a typo!

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

Siyamfahad commented 2 years ago

@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)

sljavi commented 2 years ago

@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.