UNPKG

kasa-smart-hub

Version:

Virtual Smart Hub for TP-Link Kasa Smart Home

9 lines (8 loc) 236 B
const state = {}; export default async (identified, fn) => { if (!(identified in state) || (new Date() / 1000 - state[identified]) > 5) { state[identified] = new Date() / 1000; await fn(); delete state[identified]; } };