checkApp()

in images/web/src/app.js [139:173]


    checkApp(loop) {
        console.log(this.name + " consecutive health check count: " + this.checkAppCount + "/" + this.checkAppTotal);
        fetch(this.launchURL, {
            mode: 'no-cors',
            cache: 'no-cache',
            credentials: 'include',
            redirect: 'follow',
        })
            .then((response) => {
                if (response.status < 400) {
                    if (this.checkAppCount++ >= this.checkAppTotal) {
                        this.status = "ready";
                        this.checkAppCount = 0;

                        if (this.waitLaunch) {
                            this.waitLaunch = false;
                            window.location.href = this.launchURL;
                        }
                    }
                } else {
                    // reset check
                    this.checkAppCount = 0;
                }
            })
            .catch((err) => {
                this.checkAppCount = 0;
            })
            .finally(() => {
                if (loop && this.status === "running") {
                    setTimeout(() => {
                        this.checkApp(loop);
                    }, 1000);
                }
            });
    }