intersection-observer-admin
Advanced tools
Comparing version 0.2.13 to 0.3.0
@@ -132,4 +132,6 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
else { | ||
else if (!potentialRootMatch) { | ||
// otherwise start observing this element if applicable | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
// watcher is an instance that has an observe method | ||
@@ -142,16 +144,7 @@ var intersectionObserver = this.newObserver(element, options); | ||
}; | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
var stringifiedOptions = this.stringifyOptions(options); | ||
if (potentialRootMatch) { | ||
// if share same root and need to add new entry to root match | ||
// not functional but :shrug | ||
potentialRootMatch[stringifiedOptions] = observerEntry; | ||
} | ||
else { | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
@@ -158,0 +151,0 @@ }; |
@@ -223,4 +223,6 @@ var Registry = /** @class */ (function () { | ||
} | ||
else { | ||
else if (!potentialRootMatch) { | ||
// otherwise start observing this element if applicable | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
// watcher is an instance that has an observe method | ||
@@ -233,16 +235,7 @@ var intersectionObserver = this.newObserver(element, options); | ||
}; | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
var stringifiedOptions = this.stringifyOptions(options); | ||
if (potentialRootMatch) { | ||
// if share same root and need to add new entry to root match | ||
// not functional but :shrug | ||
potentialRootMatch[stringifiedOptions] = observerEntry; | ||
} | ||
else { | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
@@ -249,0 +242,0 @@ }; |
@@ -229,4 +229,6 @@ (function (global, factory) { | ||
} | ||
else { | ||
else if (!potentialRootMatch) { | ||
// otherwise start observing this element if applicable | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
// watcher is an instance that has an observe method | ||
@@ -239,16 +241,7 @@ var intersectionObserver = this.newObserver(element, options); | ||
}; | ||
// and add entry to WeakMap under a root element | ||
// with watcher so we can use it later on | ||
var stringifiedOptions = this.stringifyOptions(options); | ||
if (potentialRootMatch) { | ||
// if share same root and need to add new entry to root match | ||
// not functional but :shrug | ||
potentialRootMatch[stringifiedOptions] = observerEntry; | ||
} | ||
else { | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
// no root exists, so add to WeakMap | ||
this.elementRegistry.addElement(root, (_a = {}, | ||
_a[stringifiedOptions] = observerEntry, | ||
_a)); | ||
} | ||
@@ -255,0 +248,0 @@ }; |
{ | ||
"name": "intersection-observer-admin", | ||
"version": "0.2.13", | ||
"version": "0.3.0", | ||
"description": "Intersection Observer Admin for better performance", | ||
@@ -5,0 +5,0 @@ "main": "dist/intersection-observer-admin.umd.js", |
@@ -13,3 +13,3 @@ intersection-observer-admin | ||
Most implementations have one Intersection Observer for each target element or so called `sentinel`. However, [IntersectionObserver.observe](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/observe) can observer multiple `sentinels`. So this library will resuse the IntersectionObserver instance for another element on the page with the same set of observer options and root element. This can dramatically improve performance for pages with lots of elements and observers. | ||
Most implementations have one Intersection Observer for each target element or so called `sentinel`. However, [IntersectionObserver.observe](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/observe) can observer multiple `sentinels`. So this library will reuse the IntersectionObserver instance for another element on the page with the same set of observer options and root element. This can dramatically improve performance for pages with lots of elements and observers. | ||
@@ -16,0 +16,0 @@ _Note: A companion library is also available for requestAnimationFrame: https://github.com/snewcomer/raf-pool_ |
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
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
112182
19
1432