npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

charm-utils

v0.0.1

Published

- Web端常用方法库汇总

Downloads

5

Readme

charm-utils

  • Web端常用方法库汇总

debounce

Debounce 防抖 适用于需要在用户操作停止后才执行函数,特别是当只关心最后一次操作结果时。

  • 滚动加载:当用户滚动页面时,使用节流可以避免频繁触发加载更多数据的请求,提高页面性能。
  • 搜索框自动补全:当用户输入搜索关键词时,使用节流可以减少请求次数,提高搜索效率。
  • 拖拽事件:当用户拖拽元素时,使用节流可以减少事件触发频率,提高拖拽性能。
  • 窗口大小改变:当用户调整窗口大小时,使用节流可以减少事件触发频率,提高页面性能。
  • 键盘输入:当用户输入内容时,使用节流可以减少事件触发频率,提高输入性能。

throttle

Throttle 节流 适用于需要控制函数执行频率,保证在特定时间间隔内至少执行一次的场景。

  • 按钮点击防重:对于重要的操作按钮,如支付、发送、删除等,使用防抖可以防止用户快速连续点击导致的多次执行。
  • 表单提交与验证:在用户填写表单时,防抖可以确保在用户完成输入并停顿后才进行验证或提交操作,减少无效验证和误提交。
  • 滚动加载:当用户滚动页面时,使用节流可以避免频繁触发加载更多数据的请求,提高页面性能。

urlSearchParams

  • urlSearchParams 是一个构造函数,用于解析 URL 查询字符串。