willmcpo / body-scroll-lock

Body scroll locking that just works with everything 😏
MIT License
4.04k stars 339 forks source link

fix addEventListener not available #214

Open st-h opened 3 years ago

st-h commented 3 years ago

When there is no addEventListener on windows (might happen with server side rendering running in node), this lib throws an exception. This PR adds a check if addEventListener is available.

But, it would even be better if no code would be run when the lib is just imported, but rather it is actively used. Then this check would not be necessary.