# throttle(func, [wait]) ⇒ function
函数节流。在wait秒内最多只执行一次func,且执行第一次触发的func
Returns: function -
返回节流函数
Author: liukun 919590347@qq.com
| Param | Type | Default | Description |
|---|---|---|---|
| func | function | 要节流的函数 | |
| [wait] | number | 300 | 需要节流的毫秒 |
Example
import { throttle } from '@wont/utils'
const testFn = () => {
console.log('throttle running...')
}
window.addEventListener('mousemove', throttle(testFn, 500))
← set toFirstCase →