stutrek / scrollmonitor

A simple and fast API to monitor elements as you scroll
MIT License
3.3k stars 243 forks source link

fix(container.ts): Check for window undefined error in SSR apps #101

Closed alokreddyk closed 1 year ago

alokreddyk commented 2 years ago

On SSR apps specially, those which do not use webpack,

window is undefined, REFERENCE ERROR would be thrown

to avoid reference errors in SSR apps this check will be helpful

Closes #99

gabrielsze commented 1 year ago

could we merge this in? will be helpful to have this fix for SSR apps

alokreddyk commented 1 year ago

could we merge this in? will be helpful to have this fix for SSR apps

@stutrek

stutrek commented 1 year ago

sorry, just saw this. Will make a release now.

stutrek commented 1 year ago

This wasn't the issue. There was a check right above this one. The problem is where it assigns window.scrollMonitor, which it does for legacy reasons.

stutrek commented 1 year ago

I published a new version that should fix #99