debounce-simple
v1.0.2
Published
simple debounce
Downloads
4
Readme
安装
npm install debounce-simple
使用
let debounce = require('debounce-simple')
let testMethods = () => {
console.log('debounce');
}
let normalMethods = testMethods
let debounceMethods = debounce(testMethods, 1000, false)
normalMethods()
normalMethods()
debounceMethods()
debounceMethods()
API
debounce(fn, delay = 500, isImmediate = true)
- fn 执行的函数
- delay 间隔的时间 default 500ms
- isImmediate true-立即执行 false-非立即执行 default true