aboutsummaryrefslogtreecommitdiff
path: root/app/src/web/assets/js/document_watcher.js
blob: 122522011a7a957f67b444a76ba2568e87fc779f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"use strict";
(function () {
    var isReady = function () {
        return document.body.scrollHeight > innerHeight + 100;
    };
    if (isReady()) {
        console.log('Already ready');
        Frost.isReady();
        return;
    }
    console.log('Injected document watcher');
    var observer = new MutationObserver(function () {
        if (isReady()) {
            observer.disconnect();
            Frost.isReady();
            console.log("Documented surpassed height in " + performance.now());
        }
    });
    observer.observe(document, {
        childList: true,
        subtree: true
    });
}).call(undefined);