JavaScript optimization to minimize redundant requests
发布时间
阅读量:
阅读量
1.前言
无聊点点公司的网页页面上 noticed that the company's website search functionality uses real-time requests, and upon checking the console, every input character triggers a new request. Although each request is small in size, this operation is not very friendly. To optimize user experience, I implemented two functionality modules: rate limiting and anti-damping mechanisms.
通常用于如按钮类的请求中进行流量控制,在防止同一时间段内频繁发送多个操作以避免网络超负荷运行
防抖函数一般用于,类似实时监听input的请求,防止请求过多
2.代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="widt
全部评论 (0)
还没有任何评论哟~
