UNPKG

@koush/ring-client-api

Version:

Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting

27 lines (26 loc) 677 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TargetValueTimer = void 0; class TargetValueTimer { setTarget(value, duration) { this.reset(); this.targetValue = value; this.timeout = setTimeout(() => { this.reset(); }, duration); } hasTarget() { return this.timeout !== undefined; } getTarget() { return this.targetValue; } reset() { if (this.timeout !== undefined) { clearTimeout(this.timeout); } this.targetValue = undefined; this.timeout = undefined; } } exports.TargetValueTimer = TargetValueTimer;