ssleptsov / ninja-keys

Keyboard shortcuts interface for your website. Working with static HTML, Vanilla JS, Vue, React, Svelte.
https://ninja-keys-demo.vercel.app/
MIT License
1.62k stars 60 forks source link

requestAnimation runs even when ninja-keys isn't loaded #41

Open jwoertink opened 1 year ago

jwoertink commented 1 year ago

Related to #34

I have a page where I don't even load ninja-keys. It's a fairly static page to only display text, and never have user interaction on it.

However, since ninja keys is added in to my main.js build, this line still seems to get ran. I think that's mainly where that error is being thrown because it seems that since ninja-keys doesn't exist on this page, there's no inputRef to hook in to.

I think this should be fairly easy to duplicate. Add a page that includes the ninja-keys import, but don't actually add the <ninja-keys /> tag. Along with nothing else on the page.