@blaze-react/utils
Advanced tools
Comparing version 0.5.0 to 0.5.13
@@ -41,10 +41,4 @@ "use strict"; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
exports.__esModule = true; | ||
require("intersection-observer"); | ||
var prop_types_1 = __importDefault(require("prop-types")); | ||
@@ -61,33 +55,25 @@ var react_1 = require("react"); | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (typeof window === "undefined") { | ||
return [2 /*return*/]; | ||
} | ||
usableRef = ref || outerRef; | ||
current = (usableRef || {}).current; | ||
if (!current) { | ||
return [2 /*return*/]; | ||
} | ||
return [4 /*yield*/, window.IntersectionObserver]; | ||
case 1: | ||
(_a.sent()) | ||
? Promise.resolve() | ||
: Promise.resolve().then(function () { return __importStar(require("intersection-observer")); }); | ||
newObserver = new IntersectionObserver(function (_a, observer) { | ||
var entry = _a[0]; | ||
var _b; | ||
setIntersecting(entry.isIntersecting); | ||
if (entry.isIntersecting) { | ||
once && ((_b = observer) === null || _b === void 0 ? void 0 : _b.unobserve(current)); | ||
} | ||
}, { | ||
rootMargin: offset | ||
}); | ||
current && newObserver.observe(current); | ||
return [2 /*return*/, function () { | ||
var _a; | ||
(_a = newObserver) === null || _a === void 0 ? void 0 : _a.unobserve(current); | ||
}]; | ||
if (typeof window === "undefined") { | ||
return [2 /*return*/]; | ||
} | ||
usableRef = ref || outerRef; | ||
current = (usableRef || {}).current; | ||
if (!current) { | ||
return [2 /*return*/]; | ||
} | ||
newObserver = new IntersectionObserver(function (_a, observer) { | ||
var entry = _a[0]; | ||
var _b; | ||
setIntersecting(entry.isIntersecting); | ||
if (entry.isIntersecting) { | ||
once && ((_b = observer) === null || _b === void 0 ? void 0 : _b.unobserve(current)); | ||
} | ||
}, { | ||
rootMargin: offset | ||
}); | ||
current && newObserver.observe(current); | ||
return [2 /*return*/, function () { | ||
var _a; | ||
(_a = newObserver) === null || _a === void 0 ? void 0 : _a.unobserve(current); | ||
}]; | ||
}); | ||
@@ -94,0 +80,0 @@ }); })(); |
{ | ||
"name": "@blaze-react/utils", | ||
"version": "0.5.0", | ||
"version": "0.5.13", | ||
"publishConfig": { | ||
@@ -41,3 +41,3 @@ "access": "public" | ||
}, | ||
"gitHead": "dbdf30fbcbab501a47076a8bdc65117bd1faf6d1" | ||
"gitHead": "1ec9a2d491939a3399a04fe086a34f88c51a0351" | ||
} |
Sorry, the diff of this file is not supported yet
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
21258
535