- Added coverage reporting for Vitest with configuration in vitest.config.mjs - Updated package.json to include new scripts for JS coverage, linting, and formatting - Modified run_quality_gate.py to allow skipping ESLint and Prettier checks - Introduced .prettierrc for consistent code formatting - Created .prettierignore to exclude specific files and directories from formatting
18 lines
421 B
JavaScript
18 lines
421 B
JavaScript
const DEFAULT_DEBOUNCE_MS = 300;
|
|
|
|
export function debounce(fn, delay = DEFAULT_DEBOUNCE_MS) {
|
|
let timer;
|
|
const debounced = (...args) => {
|
|
clearTimeout(timer);
|
|
timer = setTimeout(() => fn(...args), delay);
|
|
};
|
|
debounced.cancel = () => {
|
|
clearTimeout(timer);
|
|
};
|
|
debounced.flush = (...args) => {
|
|
clearTimeout(timer);
|
|
fn(...args);
|
|
};
|
|
return debounced;
|
|
}
|