UNPKG

homebridge-meraki-control

Version:
12 lines (11 loc) 258 B
export async function withLock(ctx, fn) { if (ctx.locks) return; ctx.locks = true; try { await fn(); } catch (error) { ctx.emit('error', `Impulse generator error: ${error}`); } finally { ctx.locks = false; } }