"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const timers_1 = __importDefault(require("./timers")); class PingTimer { constructor(keepalive, checkPing) { this.keepalive = keepalive * 1000; this.checkPing = checkPing; this.reschedule(); } clear() { if (this.timer) { timers_1.default.clear(this.timer); this.timer = null; } } reschedule() { this.clear(); this.timer = timers_1.default.set(() => { this.checkPing(); if (this.timer) { this.reschedule(); } }, this.keepalive); } } exports.default = PingTimer; //# sourceMappingURL=PingTimer.js.map