Skip to content

Commit

Permalink
Missing global variable
Browse files Browse the repository at this point in the history
some builder such as vitejs don't have global variable in this context
  • Loading branch information
zirhoo authored Dec 21, 2024
1 parent 0905ac5 commit c914b29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/resolveScrollableAncestorProp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ export default function resolveScrollableAncestorProp(scrollableAncestor) {
// When Waypoint is rendered on the server, `window` is not available.
// To make Waypoint easier to work with, we allow this to be specified in
// string form and safely convert to `window` here.
const globalWindow =
typeof window !== 'undefined' ? window :
typeof global !== 'undefined' && global.window ? global.window :
undefined;

if (scrollableAncestor === 'window') {
return global.window;
return globalWindow;
}

return scrollableAncestor;
Expand Down

1 comment on commit c914b29

@zirhoo
Copy link
Owner Author

@zirhoo zirhoo commented on c914b29 Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes civiccc#367

Please sign in to comment.