当前位置:网站首页>throttle-debounce. JS: a small anti shake throttling function library

throttle-debounce. JS: a small anti shake throttling function library

2022-06-24 23:33:00 Pengshiyu

Throttle and debounce functions.

file :

Node.js

install

npm install throttle-debounce --save

Example

import {
     throttle, debounce } from 'throttle-debounce';

// delay 100 or 250 
throttle(delay, callback, {
     noLeading=false, noTrailing=false, debounceMode })

debounce(delay, callback, {
     atBegin=false })

CDN

<!--  introduce throttle-debounce -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/index.min.js"></script>

<script> const throttleFunc = throttleDebounce.throttle(1000, ()=>{
      }); const debounceFunc = throttleDebounce.debounce(1000, ()=>{
      }); </script> 
原网站

版权声明
本文为[Pengshiyu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241833368059.html