blob: 4613dc870f8b60c0040fc74d9c4726cf2a839625 (
plain)
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
|
"use strict";
(function () {
// emit key once half the viewport is covered
var isReady, observer;
isReady = function isReady() {
if (!((typeof document !== "undefined" && document !== null ? document.body : void 0) != null)) {
return false;
}
return document.body.scrollHeight > innerHeight + 100;
};
if (isReady()) {
console.log("Already ready");
if (typeof Frost !== "undefined" && Frost !== null) {
Frost.isReady();
}
return;
}
console.log("Injected document watcher");
observer = new MutationObserver(function () {
if (isReady()) {
observer.disconnect();
if (typeof Frost !== "undefined" && Frost !== null) {
Frost.isReady();
}
return console.log("Documented surpassed height in " + performance.now());
}
});
observer.observe(document, {
childList: true,
subtree: true
});
}).call(undefined);
|