react-intersection-observer
Advanced tools
Comparing version 8.32.4 to 8.32.5
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
export { useInView } from './useInView'; | ||
export { observe, _observerMap } from './observe'; | ||
export { observe } from './observe'; | ||
export default InView; | ||
@@ -8,0 +8,0 @@ declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
import { ObserverInstanceCallback } from './index'; | ||
export declare const _observerMap: Map<string, { | ||
id: string; | ||
observer: IntersectionObserver; | ||
elements: Map<Element, Array<ObserverInstanceCallback>>; | ||
}>; | ||
/** | ||
@@ -8,0 +3,0 @@ * Convert the options to a string Id, based on the values. |
{ | ||
"name": "react-intersection-observer", | ||
"version": "8.32.4", | ||
"version": "8.32.5", | ||
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API", | ||
@@ -5,0 +5,0 @@ "source": "src/index.tsx", |
@@ -37,3 +37,3 @@ import * as React from 'react'; | ||
const _observerMap = new Map(); | ||
const observerMap = new Map(); | ||
const RootIds = new WeakMap(); | ||
@@ -69,5 +69,4 @@ let rootId = 0; | ||
let id = optionsToId(options); | ||
let instance = observerMap.get(id); | ||
let instance = _observerMap.get(id); | ||
if (!instance) { | ||
@@ -103,4 +102,3 @@ // Create a map of elements this observer is going to observe. Each element has a list of callbacks that should be triggered, once it comes into view. | ||
}; | ||
_observerMap.set(id, instance); | ||
observerMap.set(id, instance); | ||
} | ||
@@ -148,4 +146,3 @@ | ||
observer.disconnect(); | ||
_observerMap.delete(id); | ||
observerMap.delete(id); | ||
} | ||
@@ -433,3 +430,3 @@ }; | ||
export { InView, _observerMap, InView as default, observe, useInView }; | ||
export { InView, InView as default, observe, useInView }; | ||
//# sourceMappingURL=react-intersection-observer.esm.js.map |
@@ -72,3 +72,3 @@ var React = require('react'); | ||
var _observerMap = new Map(); | ||
var observerMap = new Map(); | ||
var RootIds = new WeakMap(); | ||
@@ -106,5 +106,4 @@ var rootId = 0; | ||
var id = optionsToId(options); | ||
var instance = observerMap.get(id); | ||
var instance = _observerMap.get(id); | ||
if (!instance) { | ||
@@ -142,4 +141,3 @@ // Create a map of elements this observer is going to observe. Each element has a list of callbacks that should be triggered, once it comes into view. | ||
}; | ||
_observerMap.set(id, instance); | ||
observerMap.set(id, instance); | ||
} | ||
@@ -191,4 +189,3 @@ | ||
observer.disconnect(); | ||
_observerMap["delete"](id); | ||
observerMap["delete"](id); | ||
} | ||
@@ -487,3 +484,2 @@ }; | ||
exports.InView = InView; | ||
exports._observerMap = _observerMap; | ||
exports["default"] = InView; | ||
@@ -490,0 +486,0 @@ exports.observe = observe; |
@@ -53,3 +53,3 @@ import * as React from 'react'; | ||
var _observerMap = new Map(); | ||
var observerMap = new Map(); | ||
var RootIds = new WeakMap(); | ||
@@ -87,5 +87,4 @@ var rootId = 0; | ||
var id = optionsToId(options); | ||
var instance = observerMap.get(id); | ||
var instance = _observerMap.get(id); | ||
if (!instance) { | ||
@@ -123,4 +122,3 @@ // Create a map of elements this observer is going to observe. Each element has a list of callbacks that should be triggered, once it comes into view. | ||
}; | ||
_observerMap.set(id, instance); | ||
observerMap.set(id, instance); | ||
} | ||
@@ -172,4 +170,3 @@ | ||
observer.disconnect(); | ||
_observerMap["delete"](id); | ||
observerMap["delete"](id); | ||
} | ||
@@ -467,3 +464,3 @@ }; | ||
export { InView, _observerMap, InView as default, observe, useInView }; | ||
export { InView, InView as default, observe, useInView }; | ||
//# sourceMappingURL=react-intersection-observer.m.js.map |
@@ -75,3 +75,3 @@ (function (global, factory) { | ||
var _observerMap = new Map(); | ||
var observerMap = new Map(); | ||
var RootIds = new WeakMap(); | ||
@@ -109,5 +109,4 @@ var rootId = 0; | ||
var id = optionsToId(options); | ||
var instance = observerMap.get(id); | ||
var instance = _observerMap.get(id); | ||
if (!instance) { | ||
@@ -145,4 +144,3 @@ // Create a map of elements this observer is going to observe. Each element has a list of callbacks that should be triggered, once it comes into view. | ||
}; | ||
_observerMap.set(id, instance); | ||
observerMap.set(id, instance); | ||
} | ||
@@ -194,4 +192,3 @@ | ||
observer.disconnect(); | ||
_observerMap["delete"](id); | ||
observerMap["delete"](id); | ||
} | ||
@@ -490,3 +487,2 @@ }; | ||
exports.InView = InView; | ||
exports._observerMap = _observerMap; | ||
exports["default"] = InView; | ||
@@ -493,0 +489,0 @@ exports.observe = observe; |
@@ -5,3 +5,2 @@ "use strict"; | ||
const test_utils_1 = require("react-dom/test-utils"); | ||
const index_1 = require("./index"); | ||
const observers = new Map(); | ||
@@ -46,3 +45,2 @@ beforeEach(() => { | ||
observers.clear(); | ||
index_1._observerMap.clear(); | ||
}); | ||
@@ -49,0 +47,0 @@ function triggerIntersection(elements, trigger, observer, item) { |
@@ -0,0 +0,0 @@ import { InViewHookResponse, IntersectionOptions } from './index'; |
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
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
178852
17
1887