Skip to content

Commit

Permalink
Add SSR support
Browse files Browse the repository at this point in the history
resolved rehooks#6
  • Loading branch information
evenchange4 authored May 31, 2019
1 parent 340a0de commit 8591f48
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ try {
window.removeEventListener('testPassive', null, opts)
} catch (e) {}

let getPosition = () => ({
x: window.pageXOffset,
y: window.pageYOffset,
})
let getPosition = () => {
if (typeof window === 'undefined') {
return { x: 0, y: 0 };
}
return {
x: window.pageXOffset,
y: window.pageYOffset,
};
};

let defaultOptions = {
throttle: 100,
Expand Down

0 comments on commit 8591f48

Please sign in to comment.