-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathIntersectionObserver__test.js
More file actions
57 lines (43 loc) · 1.37 KB
/
IntersectionObserver__test.js
File metadata and controls
57 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
import * as IntersectionObserverRoot$WebAPI from "../../src/IntersectionObserverAPI/IntersectionObserverRoot.js";
let observer = new IntersectionObserver((entry, observer) => {
console.log(entry, observer);
});
let root = document.querySelector("#root");
let observer2 = new IntersectionObserver((entry, observer) => {
console.log(entry, observer);
}, {
root: Primitive_option.some(root),
rootMargin: "10px",
threshold: [0.1]
});
let match = IntersectionObserverRoot$WebAPI.decode(observer2.root);
if (typeof match !== "object") {
console.log("Null");
} else if (match.TAG === "Element") {
console.log("Element");
} else {
console.log("Document");
}
let rootMargin2 = observer2.rootMargin;
let targetElement = document.querySelector("#targetElement");
if (targetElement !== null) {
observer2.observe(targetElement);
observer2.unobserve(targetElement);
} else {
console.log("Target element not found.");
}
let entries2 = observer2.takeRecords();
console.log(entries2.length);
observer2.disconnect();
let targetElement$1 = targetElement === null ? undefined : Primitive_option.some(targetElement);
export {
observer,
root,
observer2,
rootMargin2,
targetElement$1 as targetElement,
entries2,
}
/* observer Not a pure module */