Skip to content

Creates and returns a new debounced version of the passed function that will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked

rstacruz/simpler-debounce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simpler-debounce

An implementation of debounce with significantly less code.

var debounce = require('simpler-debounce')
window.onresize = debounce(resize, 200)
 
function resize (e) {
  console.log('height', window.innerHeight)
  console.log('width', window.innerWidth)
}

debounce

debounce(fn, wait)

Creates and returns a new debounced version of the passed function that will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked.

About

Creates and returns a new debounced version of the passed function that will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked

Resources

Stars

Watchers

Forks

Packages

No packages published