"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Calibration = void 0;
var Calibration = /** @class */ (function () {
    function Calibration(Main) {
        this.visible = false;
        this.container = document.querySelector('.ntsh-calibration');
        this.image = this.container.querySelector('img.stream');
        this._Main = Main;
        this.registerListeners();
        this.startClock();
    }
    Calibration.prototype.startClock = function () {
        var _this = this;
        setInterval(function () {
            if (_this.visible && _this.image)
                _this.image.src = "/calibrationImage?t=".concat(Date.now());
        }, 1000);
    };
    Calibration.prototype.registerListeners = function () {
        var _this = this;
        this.observer = new IntersectionObserver(function (entries) {
            entries.forEach(function (entry) {
                if (entry.isIntersecting) {
                    _this.visible = true;
                    // console.log('Calibration visible');
                }
                else {
                    _this.visible = false;
                    // console.log('Calibration not visible');
                }
            });
        });
        this.observer.observe(this.container);
    };
    return Calibration;
}());
exports.Calibration = Calibration;
//# sourceMappingURL=calibration.js.map