export default (fn: any, ms: number) => {
  let timer = 0;

  return () => {
    clearTimeout(timer);
    timer = setTimeout(fn, ms);
  }
} 