UNPKG

progressive-chatgpt-bot

Version:

A progressive ChatGPT feishu bot, made to assist my girlfriend's work.

24 lines 566 B
export function throttle(cb, delay) { let wait = false; let storedArgs = null; function checkStoredArgs() { if (storedArgs == null) { wait = false; } else { cb(...storedArgs); storedArgs = null; setTimeout(checkStoredArgs, delay); } } return (...args) => { if (wait) { storedArgs = args; return; } cb(...args); wait = true; setTimeout(checkStoredArgs, delay); }; } //# sourceMappingURL=utils.js.map