Skip to content

Commit

Permalink
fix: fix server side detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Aug 22, 2019
1 parent 89d51ca commit b452aeb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { css } from 'styled-components'
const REGEX_HTTPS = /^https/
const REGEX_LOCALHOST = /http:\/\/localhost/

const isSSR = typeof window === 'undefined'

export const isFunction = fn => typeof fn === 'function'

export const isObject = obj => typeof obj === 'object'
Expand Down Expand Up @@ -81,4 +83,4 @@ export const imageProxy = url => {
)}`
}

export const isLazySupported = !isNil(window) && !isNil(window.IntersectionObserver)
export const isLazySupported = !isSSR && 'IntersectionObserver' in window

0 comments on commit b452aeb

Please sign in to comment.