1.0.2 • Published 2 years ago

debounce-and-throttle v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

debounce-throttle

参数介绍

debounce方法包含两个入参

1.回调函数fn 2.连续触发时效间隔时间,支持缺省值,默认200毫秒

throttle方法包含两个入参

1.回调函数fn 2.连续触发时效间隔时间,支持缺省值,默认1000毫秒

安装

npm install debounce-and-throttle

用法示例

import {debounce,throttle} from 'debounce-and-throttle'
document.getElementById('debounceInput').addEventListener('keyup',debounce(function(e){
    console.log(this,e)
}))
document.getElementById('throttleBtn').addEventListener('click',throttle(function(e){
    console.log(this,e)
}))
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago