UNPKG

rikdat

Version:

提供了防抖和节流的完善功能,实现了参数传递和对回调函数的事件对象绑定功能

22 lines (18 loc) 524 B
## 安装 ``` npm install rikdat ``` # 导入 ```js import riktools from 'rikdat' ``` ## 防抖与节流 ```js // 调用debounce对回调函数进行防抖操作并传入参数 input.oninput = riktools.debounce(func,delay,...args) // 调用throttle对回调函数进行节流操作并传入参数 input.oninput = riktools.throttle(func,delay,...args) // 注意:如果func中要使用event对象,那么必须在func中配置event形参,而args参数中不包含该形参 ``` ## 开源协议 ISC