homebridge-econet-rheem
Version:
Homebridge plugin for control of Rheem and Ruud thermostats and water heaters
11 lines • 328 B
JavaScript
const TIMEOUTS = new Map();
const DEFAULT_TIMEOUT = 250;
export function debounce(key, task, timeout = DEFAULT_TIMEOUT) {
clearTimeout(TIMEOUTS.get(key));
TIMEOUTS.delete(key);
TIMEOUTS.set(key, setTimeout(() => {
TIMEOUTS.delete(key);
task();
}, timeout));
}
//# sourceMappingURL=debounce.js.map