export function debounce(cb: T, wait = 500) { let h: any; let callable = () => { clearTimeout(h); h = setTimeout(() => cb(), wait); }; return callable; }