UNPKG

monaco-sql-languages

Version:

SQL languages for the Monaco Editor, based on monaco-languages.

17 lines (16 loc) 492 B
export function debounce(func, timeout, immediate) { let timer = null; return (...args) => { if (timer) { clearTimeout(timer); } if (immediate && !timer) { return func === null || func === void 0 ? void 0 : func(...args); } timer = setTimeout(() => { timer && clearTimeout(timer); timer = null; func === null || func === void 0 ? void 0 : func(...args); }, timeout); }; }