Skip to content

Instantly share code, notes, and snippets.

@nicemaker
Last active May 6, 2020 11:52
Show Gist options
  • Save nicemaker/bc612b62c05b5af3be0d27f9677c0cf9 to your computer and use it in GitHub Desktop.
Save nicemaker/bc612b62c05b5af3be0d27f9677c0cf9 to your computer and use it in GitHub Desktop.
Debounce
export default function(f,ms){
let t;
return (...args)=>{
if( t ){ t = clearTimeout( t ); }
t = setTimeout( (args)=>{
clearTimeout( t );
f.apply( this,args );
},ms );
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment