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

valor-hooks

v2.0.0

Published

react hooks, 从项目代码中挖出.

Downloads

3

Readme

valor-hooks

工作中自己写的 hooks

Install

npm install --save valor-hooks

Usage

useCompositionInput

用例 1: 实时搜索

想解决的问题: 在搜索框中, 中文"张", 先输入"zh", 会匹配zh的搜索, 直到输入完成才匹配到的输入 也就是: 敲中文到一半时, 会搜索不需要的结果 参见: example/src/SearchInputDemo.js

用例 2: 状态提升时, 希望中文输入完成, 再更新 store

(比如 store.text 被两处引用, 改一处时另一处会同步变化, 这时显然不愿意看到输入一半的情况)

useEventBus

想解决的问题:
TODO: 这一段写得非常含糊!!!

  1. 属性多级下传: 需要在Editor组件中, 接收onFocus属性, 然而将此属性下传到 input 组件
  2. 事件响应零散在各个组件中: 在App组件, 接收到某事件, 在Editor等组件中进行响应 虽然也可以通过context实现, 但感觉context还是以数据为中心. 想想一个context的结构是: {onFocus, onClick...}, 会非常奇怪.

目前useEventBus是维护的全局subscribes, 所以你可以随便在不同的组件中使用
如果希望不同的范围使用不同的eventBus, 简单地使用useEventBus('namespace')模式即可

License

MIT © g770728y