intersection-observer-admin
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -115,3 +115,3 @@ var __extends = (this && this.__extends) || (function () { | ||
var _b = options.root, root = _b === void 0 ? window : _b; | ||
// find shared root element (window or scrollable area) | ||
// find shared root element (window or target HTMLElement) | ||
// this root is responsible for coordinating it's set of elements | ||
@@ -262,3 +262,3 @@ var potentialRootMatch = this._findRoot(root); | ||
* @private | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -269,14 +269,2 @@ IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
} | ||
if (Array.isArray(a)) { | ||
length = a.length; | ||
if (length !== b.length) { | ||
return false; | ||
} | ||
for (var i = length; i !== 0; i--) { | ||
if (!this._areOptionsSame(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
// simple comparison | ||
@@ -283,0 +271,0 @@ var type1 = Object.prototype.toString.call(a); |
@@ -6,3 +6,2 @@ import Notifications from './notification'; | ||
threshold?: number; | ||
scrollableArea?: string; | ||
[key: string]: any; | ||
@@ -121,3 +120,3 @@ } | ||
* @private | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -124,0 +123,0 @@ private _areOptionsSame; |
@@ -206,3 +206,3 @@ var Registry = /** @class */ (function () { | ||
var _b = options.root, root = _b === void 0 ? window : _b; | ||
// find shared root element (window or scrollable area) | ||
// find shared root element (window or target HTMLElement) | ||
// this root is responsible for coordinating it's set of elements | ||
@@ -353,3 +353,3 @@ var potentialRootMatch = this._findRoot(root); | ||
* @private | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -360,14 +360,2 @@ IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
} | ||
if (Array.isArray(a)) { | ||
length = a.length; | ||
if (length !== b.length) { | ||
return false; | ||
} | ||
for (var i = length; i !== 0; i--) { | ||
if (!this._areOptionsSame(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
// simple comparison | ||
@@ -374,0 +362,0 @@ var type1 = Object.prototype.toString.call(a); |
@@ -212,3 +212,3 @@ (function (global, factory) { | ||
var _b = options.root, root = _b === void 0 ? window : _b; | ||
// find shared root element (window or scrollable area) | ||
// find shared root element (window or target HTMLElement) | ||
// this root is responsible for coordinating it's set of elements | ||
@@ -359,3 +359,3 @@ var potentialRootMatch = this._findRoot(root); | ||
* @private | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -366,14 +366,2 @@ IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
} | ||
if (Array.isArray(a)) { | ||
length = a.length; | ||
if (length !== b.length) { | ||
return false; | ||
} | ||
for (var i = length; i !== 0; i--) { | ||
if (!this._areOptionsSame(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
// simple comparison | ||
@@ -380,0 +368,0 @@ var type1 = Object.prototype.toString.call(a); |
@@ -7,3 +7,3 @@ export interface IOptions { | ||
constructor(); | ||
elementExists(elem: HTMLElement | Window): Boolean | null; | ||
elementExists(elem: HTMLElement | Window): boolean | null; | ||
getElement(elem: HTMLElement | Window): any; | ||
@@ -10,0 +10,0 @@ /** |
@@ -6,3 +6,2 @@ import Notifications from './notification'; | ||
threshold?: number; | ||
scrollableArea?: string; | ||
[key: string]: any; | ||
@@ -121,3 +120,3 @@ } | ||
* @private | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -124,0 +123,0 @@ private _areOptionsSame; |
@@ -7,3 +7,3 @@ export interface IOptions { | ||
constructor(); | ||
elementExists(elem: HTMLElement | Window): Boolean | null; | ||
elementExists(elem: HTMLElement | Window): boolean | null; | ||
getElement(elem: HTMLElement | Window): any; | ||
@@ -10,0 +10,0 @@ /** |
{ | ||
"name": "intersection-observer-admin", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Intersection Observer Admin for better performance", | ||
@@ -5,0 +5,0 @@ "main": "dist/intersection-observer-admin.umd.js", |
@@ -15,2 +15,4 @@ intersection-observer-admin | ||
_Note: A companion library is also available for requestAnimationFrame: https://github.com/snewcomer/raf-pool_ | ||
Installation | ||
@@ -34,4 +36,2 @@ ------------------------------------------------------------------------------ | ||
- list of options to pass to Intersection Observer constructor (https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver) | ||
- scrollableArea: String | ||
- used for determining if element should use existing or new IntersectionObserver | ||
@@ -51,3 +51,3 @@ ```js | ||
// add an element in a scrolling container | ||
intersectionObserverAdmin.observe(element, { root, rootMargin: '0px 0px 100px 0px', threshold: 0, scrollableArea: '.my-list' }); | ||
intersectionObserverAdmin.observe(element, { root, rootMargin: '0px 0px 100px 0px', threshold: 0 }); | ||
@@ -54,0 +54,0 @@ // Use in cleanup lifecycle hooks (if applicable) from the element being observed |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
115552
1616