Throttle and debounce functions.
文档:
- https://github.com/niksy/throttle-debounce
- https://www.npmjs.com/package/throttle-debounce
- https://www.jsdelivr.com/package/npm/throttle-debounce
安装
npm install throttle-debounce --save
示例
import { throttle, debounce } from 'throttle-debounce';
// delay 100 or 250
throttle(delay, callback, { noLeading=false, noTrailing=false, debounceMode })
debounce(delay, callback, { atBegin=false })
CDN
const throttleFunc = throttleDebounce.throttle(1000, ()=>{});
const debounceFunc = throttleDebounce.debounce(1000, ()=>{});