intersection-observer-admin
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -258,11 +258,26 @@ var __extends = (this && this.__extends) || (function () { | ||
* @method _areOptionsSame | ||
* @param {Object} options | ||
* @param {Object} comparableOptions | ||
* @param {any} a | ||
* @param {any} b | ||
* @private | ||
* @return {Boolean} | ||
*/ | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (options, comparableOptions) { | ||
// simple comparison of string, number or even null/undefined | ||
var type1 = Object.prototype.toString.call(options); | ||
var type2 = Object.prototype.toString.call(comparableOptions); | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
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 | ||
var type1 = Object.prototype.toString.call(a); | ||
var type2 = Object.prototype.toString.call(b); | ||
if (type1 !== type2) { | ||
@@ -272,14 +287,16 @@ return false; | ||
else if (type1 !== '[object Object]' && type2 !== '[object Object]') { | ||
return options === comparableOptions; | ||
return a === b; | ||
} | ||
// complex comparison for only type of [object Object] | ||
for (var key in options) { | ||
if (options.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(options[key], comparableOptions[key]) === false) { | ||
return false; | ||
if (a && b && typeof a === 'object' && typeof b === 'object') { | ||
// complex comparison for only type of [object Object] | ||
for (var key in a) { | ||
if (a.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(a[key], b[key]) === false) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
return a !== a && b !== b; | ||
}; | ||
@@ -286,0 +303,0 @@ /** |
@@ -117,4 +117,4 @@ import Notifications from './notification'; | ||
* @method _areOptionsSame | ||
* @param {Object} options | ||
* @param {Object} comparableOptions | ||
* @param {any} a | ||
* @param {any} b | ||
* @private | ||
@@ -121,0 +121,0 @@ * @return {Boolean} |
@@ -349,11 +349,26 @@ var Registry = /** @class */ (function () { | ||
* @method _areOptionsSame | ||
* @param {Object} options | ||
* @param {Object} comparableOptions | ||
* @param {any} a | ||
* @param {any} b | ||
* @private | ||
* @return {Boolean} | ||
*/ | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (options, comparableOptions) { | ||
// simple comparison of string, number or even null/undefined | ||
var type1 = Object.prototype.toString.call(options); | ||
var type2 = Object.prototype.toString.call(comparableOptions); | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
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 | ||
var type1 = Object.prototype.toString.call(a); | ||
var type2 = Object.prototype.toString.call(b); | ||
if (type1 !== type2) { | ||
@@ -363,14 +378,16 @@ return false; | ||
else if (type1 !== '[object Object]' && type2 !== '[object Object]') { | ||
return options === comparableOptions; | ||
return a === b; | ||
} | ||
// complex comparison for only type of [object Object] | ||
for (var key in options) { | ||
if (options.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(options[key], comparableOptions[key]) === false) { | ||
return false; | ||
if (a && b && typeof a === 'object' && typeof b === 'object') { | ||
// complex comparison for only type of [object Object] | ||
for (var key in a) { | ||
if (a.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(a[key], b[key]) === false) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
return a !== a && b !== b; | ||
}; | ||
@@ -377,0 +394,0 @@ /** |
@@ -355,11 +355,26 @@ (function (global, factory) { | ||
* @method _areOptionsSame | ||
* @param {Object} options | ||
* @param {Object} comparableOptions | ||
* @param {any} a | ||
* @param {any} b | ||
* @private | ||
* @return {Boolean} | ||
*/ | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (options, comparableOptions) { | ||
// simple comparison of string, number or even null/undefined | ||
var type1 = Object.prototype.toString.call(options); | ||
var type2 = Object.prototype.toString.call(comparableOptions); | ||
IntersectionObserverAdmin.prototype._areOptionsSame = function (a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
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 | ||
var type1 = Object.prototype.toString.call(a); | ||
var type2 = Object.prototype.toString.call(b); | ||
if (type1 !== type2) { | ||
@@ -369,14 +384,16 @@ return false; | ||
else if (type1 !== '[object Object]' && type2 !== '[object Object]') { | ||
return options === comparableOptions; | ||
return a === b; | ||
} | ||
// complex comparison for only type of [object Object] | ||
for (var key in options) { | ||
if (options.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(options[key], comparableOptions[key]) === false) { | ||
return false; | ||
if (a && b && typeof a === 'object' && typeof b === 'object') { | ||
// complex comparison for only type of [object Object] | ||
for (var key in a) { | ||
if (a.hasOwnProperty(key)) { | ||
// recursion to check nested | ||
if (this._areOptionsSame(a[key], b[key]) === false) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
return a !== a && b !== b; | ||
}; | ||
@@ -383,0 +400,0 @@ /** |
@@ -117,4 +117,4 @@ import Notifications from './notification'; | ||
* @method _areOptionsSame | ||
* @param {Object} options | ||
* @param {Object} comparableOptions | ||
* @param {any} a | ||
* @param {any} b | ||
* @private | ||
@@ -121,0 +121,0 @@ * @return {Boolean} |
{ | ||
"name": "intersection-observer-admin", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Intersection Observer Admin for better performance", | ||
@@ -47,19 +47,19 @@ "main": "dist/intersection-observer-admin.umd.js", | ||
"devDependencies": { | ||
"@types/jest": "^24.0.15", | ||
"@types/node": "^12.6.8", | ||
"jest": "^24.8.0", | ||
"@types/jest": "^24.0.18", | ||
"@types/node": "^12.7.8", | ||
"jest": "^24.9.0", | ||
"lodash.camelcase": "^4.3.0", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.17.0", | ||
"rollup-plugin-typescript2": "^0.22.0", | ||
"rollup": "^1.22.0", | ||
"rollup-plugin-typescript2": "^0.24.3", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"ts-jest": "^24.0.2", | ||
"tslint": "^5.18.0", | ||
"ts-jest": "^24.1.0", | ||
"tslint": "^5.20.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.5.3" | ||
"typescript": "^3.6.3" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -45,7 +45,7 @@ intersection-observer-admin | ||
// add an element to static administrator | ||
// add an element to static administrator with window as scrollable area | ||
intersectionObserverAdmin.observe(element, { root, rootMargin: '0px 0px 100px 0px', threshold: 0 }); | ||
// add an element in a scrolling container | ||
intersectionObserverAdmin.add(element, { root, rootMargin: '0px 0px 100px 0px', threshold: 0, scrollableArea: '.my-list' }); | ||
intersectionObserverAdmin.observe(element, { root, rootMargin: '0px 0px 100px 0px', threshold: 0, scrollableArea: '.my-list' }); | ||
@@ -52,0 +52,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
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
118492
1651