当前位置:网站首页>Simple understanding of anti shake function
Simple understanding of anti shake function
2022-06-12 19:40:00 【Hello^_^ Monkey】
// Shake proof : User triggered events too frequently , Only the operation of the last event is needed
const inp = document.querySelector("input");
// Encapsulate an anti shake function
inp.oninput = debounce(function () {
console.log(this.value);
}, 500);
function debounce(fn, delay) {
let t = null;
return function () {
if (t !== null) {
clearInterval(t);
}
t = setTimeout(() => {
fn.call(this);
}, delay);
};
}
边栏推荐
- Details of thansmitablethreadlocal
- What are the third-party software testing organizations in Shanghai that share knowledge about software validation testing?
- Software usage of Tencent cloud TDP virt viewer win client
- Download and configuration of nuitka packaging tutorial
- PostgreSQL数据库复制——后台一等公民进程WalReceiver pg_stat_wal_receiver视图
- DACOM G150 dual-mode earphones make sound for love and protect the healthy growth of children's hearing
- What are meta-inf and WEB-INF respectively?
- 94. analyze the content in the web page
- 94. 解析网页中的内容
- What did 3GPP ran do in the first F2F meeting?
猜你喜欢

New product launch

leetcodeSQL:602. Friend application II: who has the most friends

负数取余问题

解释器文件

基于分布式数据库本身的定时备份方法

设备管理-借还模块1

Business opportunities with an annual increase of 3billion - non cage eggs or a new blue ocean for export to ASEAN

First build green, then build city

Demand and business model analysis-2-business model types

Negative remainder problem
随机推荐
Business opportunities with an annual increase of 3billion - non cage eggs or a new blue ocean for export to ASEAN
Reading small program graduation design based on wechat e-book (5) assignment
Demand and business model innovation-4-strategy
Ctfshow-web265 (deserialization)
leetcodeSQL:578. Questions with the highest response rate
Dacom G150双模耳机,为爱发声,呵护孩子听力健康成长
Wangxuegang room+paging3
从16页PPT里看懂Jack Dorsey的Web5
Leetcode topic [string]-344- reverse string
5g R17 standard is frozen. What does it say?
Demand and business model analysis-1-business model canvas
[generation confrontation network learning III] reading notes of Bigan paper and its principle understanding
"As a service", the future has come, starting from the present | new mode of it consumption, FOD billing on demand
[SQL] MySQL query statement execution sequence analysis
Detailed explanation of IO flow basic knowledge -- file and IO flow principle
EASYCODE one click plug-in custom template
Microsoft Word 教程,如何在 Word 中插入页码、目录?
Programming tool download address
Storage system overview
“即服务”,未来已来,始于现在 | IT消费新模式,FOD按需计费