export class SessionTimer {
    constructor(remainingSessionTimeFn, checkIntervalMillis, onSessionExpired) {
        this.remainingSessionTimeFn = remainingSessionTimeFn;
        this.checkIntervalMillis = checkIntervalMillis;
        this.onSessionExpired = onSessionExpired;
    }
    ;
    resetSessionTimer() {
        this.stopSessionTimer();
        this.sessionInterval = setInterval(() => {
            // Log.debug(`SessionTimer: ${this.remainingSessionTimeFn()} < ${this.checkIntervalMillis}`);
            if (this.remainingSessionTimeFn() < this.checkIntervalMillis) {
                clearInterval(this.sessionInterval);
                this.onSessionExpired();
            }
        }, this.checkIntervalMillis);
    }
    ;
    stopSessionTimer() {
        if (this.sessionInterval) {
            clearInterval(this.sessionInterval);
        }
    }
    ;
}
