(options: IntersectionObserverInit)
| 42 | * @param options |
| 43 | */ |
| 44 | export function optionsToId(options: IntersectionObserverInit) { |
| 45 | return Object.keys(options) |
| 46 | .sort() |
| 47 | .filter( |
| 48 | (key) => options[key as keyof IntersectionObserverInit] !== undefined, |
| 49 | ) |
| 50 | .map((key) => { |
| 51 | return `${key}_${ |
| 52 | key === "root" |
| 53 | ? getRootId(options.root) |
| 54 | : options[key as keyof IntersectionObserverInit] |
| 55 | }`; |
| 56 | }) |
| 57 | .toString(); |
| 58 | } |
| 59 | |
| 60 | function createObserver(options: IntersectionObserverInit) { |
| 61 | // Create a unique ID for this observer instance, based on the root, root margin and threshold. |
no test coverage detected
searching dependent graphs…