@restart/hooks
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -32,3 +32,3 @@ "use strict"; | ||
var observer = (0, _useStableMemo.useStableMemo)(function () { | ||
return new IntersectionObserver(setEntry, { | ||
return typeof IntersectionObserver !== 'undefined' && new IntersectionObserver(setEntry, { | ||
threshold: threshold, | ||
@@ -40,3 +40,3 @@ root: root, | ||
(0, _useIsomorphicEffect.default)(function () { | ||
if (!element) return; | ||
if (!element || !observer) return; | ||
observer.observe(element); | ||
@@ -43,0 +43,0 @@ return function () { |
@@ -23,3 +23,3 @@ import { useState } from 'react'; | ||
var observer = useStableMemo(function () { | ||
return new IntersectionObserver(setEntry, { | ||
return typeof IntersectionObserver !== 'undefined' && new IntersectionObserver(setEntry, { | ||
threshold: threshold, | ||
@@ -31,3 +31,3 @@ root: root, | ||
useEffect(function () { | ||
if (!element) return; | ||
if (!element || !observer) return; | ||
observer.observe(element); | ||
@@ -34,0 +34,0 @@ return function () { |
{ | ||
"name": "@restart/hooks", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "cjs/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80733